Skip to content

Commit 42e4780

Browse files
committed
feat(ClientV2): Add tests
1 parent d9f0f8d commit 42e4780

File tree

1 file changed

+29
-6
lines changed

1 file changed

+29
-6
lines changed

client-v2/src/test/java/com/clickhouse/client/query/QueryTests.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,7 @@
7474
import java.util.Random;
7575
import java.util.Set;
7676
import java.util.UUID;
77-
import java.util.concurrent.CountDownLatch;
78-
import java.util.concurrent.ExecutionException;
79-
import java.util.concurrent.ExecutorService;
80-
import java.util.concurrent.Executors;
81-
import java.util.concurrent.Future;
82-
import java.util.concurrent.TimeUnit;
77+
import java.util.concurrent.*;
8378
import java.util.concurrent.atomic.AtomicInteger;
8479
import java.util.function.Consumer;
8580
import java.util.function.Function;
@@ -1562,6 +1557,34 @@ public void testQueryParams() throws Exception {
15621557
Assert.assertEquals(allRecords.size(), 2);
15631558
}
15641559

1560+
@Test(groups = {"integration"})
1561+
public void testExecuteQueryParam() throws ExecutionException, InterruptedException, TimeoutException {
1562+
1563+
final String table = "execute_query_test";
1564+
Map<String, Object> query_param = Map.of("table_name",table, "engine","MergeTree");
1565+
client.execute("DROP TABLE IF EXISTS " + table).get(10, TimeUnit.SECONDS);
1566+
client.execute("CREATE TABLE {table_name:Identifier} ( id UInt32, name String, created_at DateTime) ENGINE = MergeTree ORDER BY tuple()", query_param)
1567+
.get(10, TimeUnit.SECONDS);
1568+
1569+
TableSchema schema = client.getTableSchema(table);
1570+
Assert.assertNotNull(schema);
1571+
}
1572+
1573+
@Test(groups = {"integration"})
1574+
public void testExecuteQueryParamCommandSettings() throws ExecutionException, InterruptedException, TimeoutException {
1575+
1576+
final String table = "execute_query_test";
1577+
String q1Id = UUID.randomUUID().toString();
1578+
Map<String, Object> query_param = Map.of("table_name",table, "engine","MergeTree");
1579+
client.execute("DROP TABLE IF EXISTS " + table).get(10, TimeUnit.SECONDS);
1580+
client.execute("CREATE TABLE {table_name:Identifier} ( id UInt32, name String, created_at DateTime) ENGINE = MergeTree ORDER BY tuple()",
1581+
query_param, (CommandSettings) new CommandSettings().setQueryId(q1Id))
1582+
.get(10, TimeUnit.SECONDS);
1583+
1584+
TableSchema schema = client.getTableSchema(table);
1585+
Assert.assertNotNull(schema);
1586+
}
1587+
15651588
@Test(groups = {"integration"})
15661589
public void testGetTableSchema() throws Exception {
15671590

0 commit comments

Comments
 (0)