|
15 | 15 | import lombok.AllArgsConstructor; |
16 | 16 | import lombok.Data; |
17 | 17 | import lombok.NoArgsConstructor; |
| 18 | +import org.apache.commons.lang3.StringUtils; |
18 | 19 | import org.testng.Assert; |
19 | 20 | import org.testng.annotations.AfterMethod; |
20 | 21 | import org.testng.annotations.BeforeMethod; |
|
33 | 34 | import java.util.Arrays; |
34 | 35 | import java.util.Collections; |
35 | 36 | import java.util.HashMap; |
| 37 | +import java.util.HashSet; |
36 | 38 | import java.util.List; |
37 | 39 | import java.util.Map; |
| 40 | +import java.util.Set; |
38 | 41 | import java.util.concurrent.atomic.AtomicInteger; |
39 | 42 | import java.util.function.BiConsumer; |
40 | 43 |
|
@@ -603,6 +606,29 @@ public static class DTOForDynamicPrimitivesTests { |
603 | 606 | private Object field; |
604 | 607 | } |
605 | 608 |
|
| 609 | + @Test(groups = {"integration"}) |
| 610 | + public void testAllDataTypesKnown() { |
| 611 | + List<GenericRecord> dbTypes = client.queryAll("SELECT * FROM system.data_type_families"); |
| 612 | + Set<String> unknowTypes = new HashSet<>(); |
| 613 | + for (GenericRecord dbType : dbTypes) { |
| 614 | + String aliasFor = dbType.getString("alias_to"); |
| 615 | + String typeToCheck; |
| 616 | + if (StringUtils.isNoneBlank(aliasFor)) { |
| 617 | + typeToCheck = aliasFor; |
| 618 | + } else { |
| 619 | + typeToCheck = dbType.getString("name"); |
| 620 | + } |
| 621 | + |
| 622 | + try { |
| 623 | + ClickHouseDataType.valueOf(typeToCheck); |
| 624 | + } catch (Exception e) { |
| 625 | + unknowTypes.add(typeToCheck); |
| 626 | + } |
| 627 | + } |
| 628 | + |
| 629 | + Assert.assertTrue(unknowTypes.isEmpty(), "There are some unknown types: " + unknowTypes); |
| 630 | + } |
| 631 | + |
606 | 632 | private void testDynamicWith(String withWhat, Object[] values, String[] expectedStrValues) throws Exception { |
607 | 633 | if (isVersionMatch("(,24.8]")) { |
608 | 634 | return; |
|
0 commit comments