Skip to content

Commit 14bde0d

Browse files
author
Paultagoras
committed
Test was split off
1 parent 5e83ba8 commit 14bde0d

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

jdbc-v2/src/test/java/com/clickhouse/jdbc/DataTypeTests.java

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -321,35 +321,29 @@ public void testStringTypes() throws SQLException {
321321
runQuery("CREATE TABLE test_strings (order Int8, "
322322
+ "str String, fixed FixedString(6), "
323323
+ "enum Enum8('a' = 6, 'b' = 7, 'c' = 8), enum8 Enum8('a' = 1, 'b' = 2, 'c' = 3), enum16 Enum16('a' = 1, 'b' = 2, 'c' = 3), "
324-
+ "uuid UUID, ipv4 IPv4, ipv6 IPv6, "
325-
+ "escaped String "
324+
+ "uuid UUID, escaped String "
326325
+ ") ENGINE = MergeTree ORDER BY ()");
327326

328327
// Insert random (valid) values
329328
long seed = System.currentTimeMillis();
330329
Random rand = new Random(seed);
331-
log.info("Random seed was: {}", seed);
332330

333331
String str = "string" + rand.nextInt(1000);
334332
String fixed = "fixed" + rand.nextInt(10);
335333
String enum8 = "a";
336334
String enum16 = "b";
337335
String uuid = UUID.randomUUID().toString();
338-
String ipv4 = rand.nextInt(256) + "." + rand.nextInt(256) + "." + rand.nextInt(256) + "." + rand.nextInt(256);
339-
String ipv6 = "2001:adb8:85a3:1:2:8a2e:370:7334";
340336
String escaped = "\\xA3\\xA3\\x12\\xA0\\xDF\\x13\\x4E\\x8C\\x87\\x74\\xD4\\x53\\xDB\\xFC\\x34\\x95";
341337

342338
try (Connection conn = getConnection()) {
343-
try (PreparedStatement stmt = conn.prepareStatement("INSERT INTO test_strings VALUES ( 1, ?, ?, ?, ?, ?, ?, ?, ?, ? )")) {
339+
try (PreparedStatement stmt = conn.prepareStatement("INSERT INTO test_strings VALUES ( 1, ?, ?, ?, ?, ?, ?, ? )")) {
344340
stmt.setString(1, str);
345341
stmt.setString(2, fixed);
346342
stmt.setString(3, enum8);
347343
stmt.setString(4, enum8);
348344
stmt.setString(5, enum16);
349345
stmt.setString(6, uuid);
350-
stmt.setString(7, ipv4);
351-
stmt.setString(8, ipv6);
352-
stmt.setString(9, escaped);
346+
stmt.setString(7, escaped);
353347
stmt.executeUpdate();
354348
}
355349
}
@@ -368,8 +362,6 @@ public void testStringTypes() throws SQLException {
368362
assertEquals(rs.getString("enum16"), "b");
369363
assertEquals(rs.getInt("enum16"), 2);
370364
assertEquals(rs.getString("uuid"), uuid);
371-
assertEquals(rs.getString("ipv4"), "/" + ipv4);
372-
assertEquals(rs.getString("ipv6"), "/" + ipv6);
373365
assertEquals(rs.getString("escaped"), escaped);
374366
assertFalse(rs.next());
375367
}
@@ -379,7 +371,7 @@ public void testStringTypes() throws SQLException {
379371

380372
@Test(groups = { "integration" })
381373
public void testIpAddressTypes() throws SQLException, UnknownHostException {
382-
runQuery("CREATE TABLE test_strings (order Int8, "
374+
runQuery("CREATE TABLE test_ips (order Int8, "
383375
+ "ipv4_ip IPv4, ipv4_name IPv4, ipv6 IPv6"
384376
+ ") ENGINE = MergeTree ORDER BY ()");
385377

@@ -392,7 +384,7 @@ public void testIpAddressTypes() throws SQLException, UnknownHostException {
392384
InetAddress ipv6Address = Inet6Address.getByName("2001:adb8:85a3:1:2:8a2e:370:7334");
393385

394386
try (Connection conn = getConnection()) {
395-
try (PreparedStatement stmt = conn.prepareStatement("INSERT INTO test_strings VALUES ( 1, ?, ?, ? )")) {
387+
try (PreparedStatement stmt = conn.prepareStatement("INSERT INTO test_ips VALUES ( 1, ?, ?, ? )")) {
396388
stmt.setObject(1, ipv4AddressByIp);
397389
stmt.setObject(2, ipv4AddressByName);
398390
stmt.setObject(3, ipv6Address);
@@ -403,7 +395,7 @@ public void testIpAddressTypes() throws SQLException, UnknownHostException {
403395
// Check the results
404396
try (Connection conn = getConnection()) {
405397
try (Statement stmt = conn.createStatement()) {
406-
try (ResultSet rs = stmt.executeQuery("SELECT * FROM test_strings ORDER BY order")) {
398+
try (ResultSet rs = stmt.executeQuery("SELECT * FROM test_ips ORDER BY order")) {
407399
assertTrue(rs.next());
408400
assertEquals(rs.getObject("ipv4_ip"), ipv4AddressByIp);
409401
assertEquals(rs.getObject("ipv4_name"), ipv4AddressByName);

0 commit comments

Comments
 (0)