diff --git a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java
index 7175d06b..f5937302 100644
--- a/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java
+++ b/clickhouse-native-jdbc/src/test/java/com/github/housepower/jdbc/AbstractITest.java
@@ -41,27 +41,36 @@ public abstract class AbstractITest implements Serializable {
protected static final String CLICKHOUSE_PASSWORD = SystemUtil.loadProp("CLICKHOUSE_PASSWORD", "");
protected static final String CLICKHOUSE_DB = SystemUtil.loadProp("CLICKHOUSE_DB", "");
- protected static final int CLICKHOUSE_GRPC_PORT = 9100;
protected static final int CLICKHOUSE_HTTP_PORT = 8123;
+ protected static final int CLICKHOUSE_HTTPS_PORT = 8443;
protected static final int CLICKHOUSE_NATIVE_PORT = 9000;
+ protected static final int CLICKHOUSE_NATIVE_SECURE_PORT = 9440;
@Container
public static ClickHouseContainer container = new ClickHouseContainer(CLICKHOUSE_IMAGE)
.withEnv("CLICKHOUSE_USER", CLICKHOUSE_USER)
.withEnv("CLICKHOUSE_PASSWORD", CLICKHOUSE_PASSWORD)
.withEnv("CLICKHOUSE_DB", CLICKHOUSE_DB)
- .withExposedPorts(CLICKHOUSE_HTTP_PORT, CLICKHOUSE_NATIVE_PORT, CLICKHOUSE_GRPC_PORT)
- .withCopyFileToContainer(MountableFile.forClasspathResource("grpc_config.xml"), "/etc/clickhouse-server/config.d/grpc_config.xml");
+ .withExposedPorts(CLICKHOUSE_HTTP_PORT,
+ CLICKHOUSE_HTTPS_PORT,
+ CLICKHOUSE_NATIVE_PORT,
+ CLICKHOUSE_NATIVE_SECURE_PORT)
+ .withCopyFileToContainer(MountableFile.forClasspathResource("clickhouse/config/config.xml"),
+ "/etc/clickhouse-server/config.xml")
+ .withCopyFileToContainer(MountableFile.forClasspathResource("clickhouse/config/users.xml"),
+ "/etc/clickhouse-server/users.xml")
+ .withCopyFileToContainer(MountableFile.forClasspathResource("clickhouse/server.key"),
+ "/etc/clickhouse-server/server.key")
+ .withCopyFileToContainer(MountableFile.forClasspathResource("clickhouse/server.crt"),
+ "/etc/clickhouse-server/server.crt");
protected static String CK_HOST;
protected static int CK_PORT;
- protected static int CK_GRPC_PORT;
@BeforeAll
public static void extractContainerInfo() {
CK_HOST = container.getHost();
CK_PORT = container.getMappedPort(CLICKHOUSE_NATIVE_PORT);
- CK_GRPC_PORT = container.getMappedPort(CLICKHOUSE_GRPC_PORT);
}
/**
diff --git a/clickhouse-native-jdbc/src/test/resources/clickhouse/config/config.xml b/clickhouse-native-jdbc/src/test/resources/clickhouse/config/config.xml
new file mode 100644
index 00000000..202070de
--- /dev/null
+++ b/clickhouse-native-jdbc/src/test/resources/clickhouse/config/config.xml
@@ -0,0 +1,1198 @@
+
+
+
+
+
+ trace
+ /var/log/clickhouse-server/clickhouse-server.log
+ /var/log/clickhouse-server/clickhouse-server.err.log
+
+ 1000M
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 8123
+
+
+ 9000
+
+
+ 9004
+
+
+ 9005
+
+
+ 8443
+
+
+ 9440
+
+
+
+
+
+ 9009
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 4096
+
+
+ 3
+
+
+
+
+ false
+
+
+ /path/to/ssl_cert_file
+ /path/to/ssl_key_file
+
+
+ false
+
+
+ /path/to/ssl_ca_cert_file
+
+
+ deflate
+
+
+ medium
+
+
+ -1
+ -1
+
+
+ false
+
+
+
+
+
+
+ /etc/clickhouse-server/server.crt
+ /etc/clickhouse-server/server.key
+
+
+ none
+ true
+ true
+ sslv2,sslv3
+ true
+
+
+
+ true
+ true
+ sslv2,sslv3
+ true
+
+
+
+ RejectCertificateHandler
+
+
+
+
+
+
+
+
+ 100
+
+
+ 0
+
+
+
+ 10000
+
+
+ 0.9
+
+
+ 4194304
+
+
+ 0
+
+
+
+
+
+ 8589934592
+
+
+ 5368709120
+
+
+
+ 1000
+
+
+ 134217728
+
+
+ /var/lib/clickhouse/
+
+
+ /var/lib/clickhouse/tmp/
+
+
+
+
+
+ /var/lib/clickhouse/user_files/
+
+
+
+
+
+
+
+
+
+
+
+
+ users.xml
+
+
+
+ /var/lib/clickhouse/access/
+
+
+
+
+
+
+ default
+
+
+
+
+
+
+
+
+
+
+
+ default
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+ ' | sed -e 's|.*>\(.*\)<.*|\1|')
+ wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge_$PKG_VER-1_all.deb
+ apt install --no-install-recommends -f ./clickhouse-jdbc-bridge_$PKG_VER-1_all.deb
+ clickhouse-jdbc-bridge &
+
+ * [CentOS/RHEL]
+ export MVN_URL=https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge
+ export PKG_VER=$(curl -sL $MVN_URL/maven-metadata.xml | grep '' | sed -e 's|.*>\(.*\)<.*|\1|')
+ wget https://github.com/ClickHouse/clickhouse-jdbc-bridge/releases/download/v$PKG_VER/clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm
+ yum localinstall -y clickhouse-jdbc-bridge-$PKG_VER-1.noarch.rpm
+ clickhouse-jdbc-bridge &
+
+ Please refer to https://github.com/ClickHouse/clickhouse-jdbc-bridge#usage for more information.
+ ]]>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ localhost
+ 9000
+
+
+
+
+
+
+
+
+ localhost
+ 9000
+
+
+
+
+ localhost
+ 9000
+
+
+
+
+
+
+ 127.0.0.1
+ 9000
+
+
+
+
+ 127.0.0.2
+ 9000
+
+
+
+
+
+ true
+
+ 127.0.0.1
+ 9000
+
+
+
+ true
+
+ 127.0.0.2
+ 9000
+
+
+
+
+
+
+ localhost
+ 9440
+ 1
+
+
+
+
+
+
+ localhost
+ 9000
+
+
+
+
+ localhost
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3600
+
+
+
+ 3600
+
+
+ 60
+
+
+
+
+
+
+
+
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+
+
+
+
+
+ 7500
+
+
+
+
+ system
+
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+ system
+
+ toYYYYMM(event_date)
+ 7500
+
+
+
+
+
+
+ system
+
+ 7500
+ 1000
+
+
+
+
+ system
+
+
+ 7000
+
+
+
+
+
+
+ engine MergeTree
+ partition by toYYYYMM(finish_date)
+ order by (finish_date, finish_time_us, trace_id)
+
+ system
+
+ 7500
+
+
+
+
+
+ system
+
+
+
+ 1000
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ *_dictionary.xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+ /clickhouse/task_queue/ddl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ click_cost
+ any
+
+ 0
+ 3600
+
+
+ 86400
+ 60
+
+
+
+ max
+
+ 0
+ 60
+
+
+ 3600
+ 300
+
+
+ 86400
+ 3600
+
+
+
+
+
+ /var/lib/clickhouse/format_schemas/
+
+
+
+
+ hide encrypt/decrypt arguments
+ ((?:aes_)?(?:encrypt|decrypt)(?:_mysql)?)\s*\(\s*(?:'(?:\\'|.)+'|.*?)\s*\)
+
+ \1(???)
+
+
+
+
+
+
+
+
+
+ false
+
+ false
+
+
+ https://6f33034cfe684dd7a3ab9875e57b1c8d@o388870.ingest.sentry.io/5226277
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/clickhouse-native-jdbc/src/test/resources/clickhouse/config/users.xml b/clickhouse-native-jdbc/src/test/resources/clickhouse/config/users.xml
new file mode 100644
index 00000000..c7cf0f5b
--- /dev/null
+++ b/clickhouse-native-jdbc/src/test/resources/clickhouse/config/users.xml
@@ -0,0 +1,123 @@
+
+
+
+
+
+
+
+
+
+ 10000000000
+
+
+ random
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ ::/0
+
+
+
+ default
+
+
+ default
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 3600
+
+
+ 0
+ 0
+ 0
+ 0
+ 0
+
+
+
+
\ No newline at end of file
diff --git a/clickhouse-native-jdbc/src/test/resources/clickhouse/server.crt b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.crt
new file mode 100644
index 00000000..ed279bd9
--- /dev/null
+++ b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.crt
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDCTCCAfGgAwIBAgIUGiof/tcvWR9ITSWwONatZC68ys0wDQYJKoZIhvcNAQEL
+BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MB4XDTIzMDgyNjIxMTczN1oXDTI0MDgy
+NTIxMTczN1owFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0BAQEF
+AAOCAQ8AMIIBCgKCAQEAmC1y+HO3QzDIk5DnK6ouUoxCIH6c/zeT/uYSCmvUQU1l
+rEWQ5+U/iEAQkmIyK/7yvyHromp+ZfzoVlDANF/5d3OaRcXxLKjVBf1xxELlEzXR
+Jw2Vx3KnrxO0P9RXwmuc+n8alYZwxIbt1IPlqGJzgUHd3cFcjXe7Z8dnhAO3zekr
+UDRP028LdIrLPGpBanHNKiJv73o3QrNJKLw9l5kDPMlmrXb/9uot4xxYj6L3Kz84
+lACApL04tkH3+W6vadwdzWjPEvFwlLIoRBV1YXnzKUlgNwey6PLDo5jE+2AXR433
+6UPHZJ5XNTtJ1zSe+wiC8xqA5zgv2f/S6KNrGAZ4JQIDAQABo1MwUTAdBgNVHQ4E
+FgQUucBNLF7S0DEqgJYTpD0Y6rKZx6kwHwYDVR0jBBgwFoAUucBNLF7S0DEqgJYT
+pD0Y6rKZx6kwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAN9i6
+xLrh4DyJOV1KsIM1nrWq1P5wZjQny9i4TmU6doGXIiTIAipXyL8liX5/3qVGZkBb
+WYWgQTdfjjZJENSawxUiIQnsvqO83dyzRaMg+yKRUPf6MZTQDxjgmK3BZ6qmMLbj
+BhMYAA5r6b6oTW5pmqo+wQxP7doZOiX/Xcjw2iHBtL1jy4rEwsEoOYpH7u0ywWiQ
+9WsaYNcm+b452MJBYWeRqxJx4gtvcBFAii2Win5AT/SUTtHQcQKrDxv+osGS5vZj
+v+2LxCCNfTmJfIsGPSsyiqulvzzn4xcNE6ETzAcvudx+to9YfUogJYmhsQpc/CBa
+7DYS2q7Uf7a7d7xZDw==
+-----END CERTIFICATE-----
diff --git a/clickhouse-native-jdbc/src/test/resources/clickhouse/server.jks b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.jks
new file mode 100644
index 00000000..a83d56c2
Binary files /dev/null and b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.jks differ
diff --git a/clickhouse-native-jdbc/src/test/resources/clickhouse/server.key b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.key
new file mode 100644
index 00000000..357188fc
--- /dev/null
+++ b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.key
@@ -0,0 +1,28 @@
+-----BEGIN PRIVATE KEY-----
+MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCYLXL4c7dDMMiT
+kOcrqi5SjEIgfpz/N5P+5hIKa9RBTWWsRZDn5T+IQBCSYjIr/vK/Ieuian5l/OhW
+UMA0X/l3c5pFxfEsqNUF/XHEQuUTNdEnDZXHcqevE7Q/1FfCa5z6fxqVhnDEhu3U
+g+WoYnOBQd3dwVyNd7tnx2eEA7fN6StQNE/Tbwt0iss8akFqcc0qIm/vejdCs0ko
+vD2XmQM8yWatdv/26i3jHFiPovcrPziUAICkvTi2Qff5bq9p3B3NaM8S8XCUsihE
+FXVhefMpSWA3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c4llQvujl7pdPUDpkEij9Yw28k09zB1Ro8X0aq
+xGJNYqiaJBmp4fY43uIxLc8dUpS7KGZL4vc89pJHAoGAET1i4vxlD6BMgwJCyCmc
+afJ5Eh4WrrBYM+E4emGS0/pgeRkjRk5cCaKJ/IEO8x2uxr/EGmlZa+ki8ETc8/9m
+LG9sX9za2lg9tiZW8A676hheVHe4IOIjkldey9ovxm8ar12PECwgkkJ6WXeG4uzJ
+lqaPsbBiOzZvBiBBJLpydYY=
+-----END PRIVATE KEY-----
diff --git a/clickhouse-native-jdbc/src/test/resources/clickhouse/server.p12 b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.p12
new file mode 100644
index 00000000..eb7c886c
Binary files /dev/null and b/clickhouse-native-jdbc/src/test/resources/clickhouse/server.p12 differ
diff --git a/clickhouse-native-jdbc/src/test/resources/grpc_config.xml b/clickhouse-native-jdbc/src/test/resources/grpc_config.xml
deleted file mode 100644
index a6416daf..00000000
--- a/clickhouse-native-jdbc/src/test/resources/grpc_config.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
- 9100
-
- false
-
-
- /path/to/ssl_cert_file
- /path/to/ssl_key_file
-
-
- false
-
-
- /path/to/ssl_ca_cert_file
-
-
- deflate
-
-
- medium
-
-
- -1
- -1
-
-
- true
-
-
diff --git a/clickhouse-native-jdbc/src/test/resources/keymanagement/bin/generate.sh b/clickhouse-native-jdbc/src/test/resources/keymanagement/bin/generate.sh
new file mode 100644
index 00000000..eb93e96a
--- /dev/null
+++ b/clickhouse-native-jdbc/src/test/resources/keymanagement/bin/generate.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Versions:
+# Windows 10
+# OpenSSL Version: OpenSSL 3.1.2 1
+# Keytool Version: openjdk-17.0.2
+
+KEY_FILE=server.key
+CRT_FILE=server.crt
+PKCS12_FILE=server.p12
+JKS_FILE=server.jks
+PASSWORD=mypassword
+ALIAS=myalias
+
+echo "Generating the private key and certificate..."
+openssl req -subj "//CN=localhost" -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout ${KEY_FILE} -out ${CRT_FILE}
+if [ $? -ne 0 ]; then
+ echo "Failed to generate the private key and certificate."
+ exit 1
+fi
+
+echo "Converting to PKCS12 format..."
+openssl pkcs12 -export -in ${CRT_FILE} -inkey ${KEY_FILE} -out ${PKCS12_FILE} -name ${ALIAS} -password pass:${PASSWORD}
+if [ $? -ne 0 ]; then
+ echo "Failed to convert to PKCS12 format."
+ exit 1
+fi
+
+echo "Importing keystore ${PKCS12_FILE} to ${JKS_FILE}..."
+keytool -importkeystore\
+ -srckeystore ${PKCS12_FILE}\
+ -srcstoretype PKCS12\
+ -srcstorepass ${PASSWORD}\
+ -destkeystore ${JKS_FILE}\
+ -deststoretype JKS\
+ -deststorepass ${PASSWORD}
+if [ $? -ne 0 ]; then
+ echo "Failed to import keystore."
+ exit 1
+fi
+
+echo "Done!"
\ No newline at end of file