33import com .clickhouse .client .BaseIntegrationTest ;
44import com .clickhouse .client .ClickHouseNode ;
55import com .clickhouse .client .ClickHouseProtocol ;
6+ import com .clickhouse .client .ClickHouseServerForTest ;
67import com .clickhouse .client .api .Client ;
78import com .clickhouse .client .api .ClientException ;
89import com .clickhouse .client .api .ServerException ;
910import com .clickhouse .client .api .command .CommandResponse ;
1011import com .clickhouse .client .api .enums .Protocol ;
12+ import com .clickhouse .client .api .internal .ServerSettings ;
1113import org .testng .Assert ;
1214import org .testng .annotations .BeforeMethod ;
1315import org .testng .annotations .Test ;
@@ -21,14 +23,7 @@ public class CommandTests extends BaseIntegrationTest {
2123
2224 @ BeforeMethod (groups = {"integration" })
2325 public void setUp () {
24- ClickHouseNode node = getServer (ClickHouseProtocol .HTTP );
25- client = new Client .Builder ()
26- .addEndpoint (Protocol .HTTP , node .getHost (), node .getPort (), false )
27- .setUsername ("default" )
28- .setPassword ("" )
29- .build ();
30-
31- System .out .println ("Real port: " + node .getPort ());
26+ client = newClient ().build ();
3227 }
3328
3429
@@ -54,4 +49,17 @@ public void testInvalidCommandExecution() throws Exception {
5449 // expected
5550 }
5651 }
52+
53+ protected Client .Builder newClient () {
54+ ClickHouseNode node = getServer (ClickHouseProtocol .HTTP );
55+ boolean isSecure = isCloud ();
56+ return new Client .Builder ()
57+ .addEndpoint (Protocol .HTTP , node .getHost (), node .getPort (), isSecure )
58+ .setUsername ("default" )
59+ .setPassword (ClickHouseServerForTest .getPassword ())
60+ .compressClientRequest (false )
61+ .setDefaultDatabase (ClickHouseServerForTest .getDatabase ())
62+ .serverSetting (ServerSettings .WAIT_END_OF_QUERY , "1" )
63+ .useNewImplementation (System .getProperty ("client.tests.useNewImplementation" , "true" ).equals ("true" ));
64+ }
5765}
0 commit comments