From b574f8a390fb4e2cb1f5454674e051000f125eb9 Mon Sep 17 00:00:00 2001 From: linghengqian Date: Mon, 10 Oct 2022 22:51:00 +0800 Subject: [PATCH 1/4] Update library to serve unit testing inside GraalVM Native Image --- .github/workflows/test-myself.yml | 45 +++++++++++++++++++ agent/plugins/tracing/test/pom.xml | 5 +++ .../proxy/src/main/release-docs/LICENSE | 20 ++++----- examples/pom.xml | 2 +- mode/core/pom.xml | 4 ++ .../schema/TableMetaDataPersistService.java | 6 +-- .../schema/ViewMetaDataPersistService.java | 2 +- pom.xml | 32 ++++++++----- test/common/pom.xml | 5 +++ test/parser/pom.xml | 5 +++ 10 files changed, 101 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/test-myself.yml diff --git a/.github/workflows/test-myself.yml b/.github/workflows/test-myself.yml new file mode 100644 index 0000000000000..d05294c42247d --- /dev/null +++ b/.github/workflows/test-myself.yml @@ -0,0 +1,45 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: Test Myself + +on: + push: + branches: [ junit-next ] + +jobs: + build: + timeout-minutes: 90 + permissions: + contents: read + packages: write + name: Test Myself on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + fail-fast: false + steps: + - uses: actions/checkout@v2 + - uses: graalvm/setup-graalvm@v1 + with: + version: '22.2.0' + java-version: '17' + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + cache: 'maven' + - name: Test Myself + run: ./mvnw clean install -Prelease -T2C diff --git a/agent/plugins/tracing/test/pom.xml b/agent/plugins/tracing/test/pom.xml index b8e1ef8b66b70..6a4e8c5c0959c 100644 --- a/agent/plugins/tracing/test/pom.xml +++ b/agent/plugins/tracing/test/pom.xml @@ -55,6 +55,11 @@ junit compile + + org.junit.vintage + junit-vintage-engine + compile + org.mockito mockito-core diff --git a/distribution/proxy/src/main/release-docs/LICENSE b/distribution/proxy/src/main/release-docs/LICENSE index 47b191249a4c0..bec804446880f 100644 --- a/distribution/proxy/src/main/release-docs/LICENSE +++ b/distribution/proxy/src/main/release-docs/LICENSE @@ -222,7 +222,7 @@ The text of each license is the standard Apache 2.0 license. avatica-core 1.22.0: https://calcite.apache.org/avatica, Apache 2.0 avatica-metrics 1.22.0: https://calcite.apache.org/avatica, Apache 2.0 auto-service-annotations 1.0: https://github.com/google/auto/tree/master/service, Apache 2.0 - caffeine 2.9.2: https://github.com/ben-manes/caffeine, Apache 2.0 + caffeine 2.9.3: https://github.com/ben-manes/caffeine, Apache 2.0 calcite-core 1.32.0: https://calcite.apache.org, Apache 2.0 calcite-linq4j 1.32.0: https://calcite.apache.org, Apache 2.0 commons-codec 1.15: https://github.com/apache/commons-codec, Apache 2.0 @@ -232,15 +232,15 @@ The text of each license is the standard Apache 2.0 license. commons-lang 2.6: https://github.com/apache/commons-lang, Apache 2.0 commons-lang3 3.8: https://github.com/apache/commons-lang, Apache 2.0 commons-logging 1.1.3: https://github.com/apache/commons-logging, Apache 2.0 - curator-client 5.1.0: https://github.com/apache/curator, Apache 2.0 - curator-framework 5.1.0: https://github.com/apache/curator, Apache 2.0 - curator-recipes 5.1.0: https://github.com/apache/curator, Apache 2.0 + curator-client 5.3.0: https://github.com/apache/curator, Apache 2.0 + curator-framework 5.3.0: https://github.com/apache/curator, Apache 2.0 + curator-recipes 5.3.0: https://github.com/apache/curator, Apache 2.0 cosid-core 1.14.4: https://github.com/Ahoo-Wang/CosId, Apache 2.0 error_prone_annotations 2.3.4: https://github.com/google/error-prone, Apache 2.0 failsafe 2.4.1: https://github.com/jhalterman/failsafe, Apache 2.0 failureaccess 1.0.1: https://github.com/google/guava, Apache 2.0 freemarker 2.3.31: https://freemarker.apache.org/, Apache 2.0 - groovy 4.0.3: https://groovy.apache.org/, Apache 2.0 + groovy 4.0.5: https://groovy.apache.org/, Apache 2.0 grpc-api 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 grpc-context 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 grpc-core 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 @@ -251,7 +251,7 @@ The text of each license is the standard Apache 2.0 license. grpc-stub 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 gson 2.9.1: https://github.com/google/gson, Apache 2.0 guava 30.0-jre: https://github.com/google/guava, Apache 2.0 - HikariCP 3.4.2: https://github.com/brettwooldridge/HikariCP, Apache 2.0 + HikariCP 4.0.3: https://github.com/brettwooldridge/HikariCP, Apache 2.0 httpclient5 5.1.3: https://hc.apache.org/httpcomponents-client-5.1.x, Apache 2.0 httpcore5-h2 5.1.3: https://hc.apache.org/httpcomponents-core-5.1.x, Apache 2.0 httpcore5 5.1.3: https://hc.apache.org/httpcomponents-core-5.1.x, Apache 2.0 @@ -260,8 +260,8 @@ The text of each license is the standard Apache 2.0 license. jackson-databind 2.10.0: http://github.com/FasterXML/jackson, Apache 2.0 jackson-dataformat-yaml 2.13.2: http://github.com/FasterXML/jackson, Apache 2.0 jcl-over-slf4j 1.7.36: https://github.com/qos-ch/slf4j, Apache 2.0 - jetcd-common 0.5.10: https://github.com/etcd-io/jetcd, Apache 2.0 - jetcd-core 0.5.10: https://github.com/etcd-io/jetcd, Apache 2.0 + jetcd-common 0.7.3: https://github.com/etcd-io/jetcd, Apache 2.0 + jetcd-core 0.7.3: https://github.com/etcd-io/jetcd, Apache 2.0 json-path 2.7.0: https://github.com/jayway/JsonPath, Apache 2.0 json-smart 2.4.7: https://www.minidev.net/, Apache 2.0 json-simple 1.1.1: https://code.google.com/archive/p/json-simple/, Apache 2.0 @@ -293,8 +293,8 @@ The text of each license is the standard Apache 2.0 license. uzaygezen-core 0.2: https://code.google.com/p/uzaygezen, Apache 2.0 vertx-mysql-client 4.3.3: https://github.com/eclipse-vertx/vertx-sql-client, Apache 2.0 vertx-sql-client 4.3.3: https://github.com/eclipse-vertx/vertx-sql-client, Apache 2.0 - zookeeper 3.6.0: https://github.com/apache/zookeeper, Apache 2.0 - zookeeper-jute 3.6.0: https://github.com/apache/zookeeper, Apache 2.0 + zookeeper 3.8.0: https://github.com/apache/zookeeper, Apache 2.0 + zookeeper-jute 3.8.0: https://github.com/apache/zookeeper, Apache 2.0 ======================================================================== Apache 2.0 licenses diff --git a/examples/pom.xml b/examples/pom.xml index 0a39691f48272..7ed84360905f2 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -64,7 +64,7 @@ 1.4.2 - 4.13.2 + 4.13.2 1.3 2.7.21 diff --git a/mode/core/pom.xml b/mode/core/pom.xml index bf66e05cd38d5..c2390fd7da643 100644 --- a/mode/core/pom.xml +++ b/mode/core/pom.xml @@ -51,5 +51,9 @@ ${project.version} test + + org.apache.commons + commons-lang3 + diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/TableMetaDataPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/TableMetaDataPersistService.java index f1b0a4030ca29..2b269f12e7526 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/TableMetaDataPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/TableMetaDataPersistService.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.mode.metadata.persist.service.schema; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereTable; import org.apache.shardingsphere.infra.util.yaml.YamlEngine; import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereTable; @@ -26,10 +26,10 @@ import org.apache.shardingsphere.mode.metadata.persist.node.DatabaseMetaDataNode; import org.apache.shardingsphere.mode.persist.PersistRepository; -import java.util.Map; -import java.util.LinkedHashMap; import java.util.Collection; import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.Map; /** * Table meta data persist service. diff --git a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/ViewMetaDataPersistService.java b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/ViewMetaDataPersistService.java index 65adcf8637615..79f52c27854ba 100644 --- a/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/ViewMetaDataPersistService.java +++ b/mode/core/src/main/java/org/apache/shardingsphere/mode/metadata/persist/service/schema/ViewMetaDataPersistService.java @@ -18,7 +18,7 @@ package org.apache.shardingsphere.mode.metadata.persist.service.schema; import lombok.RequiredArgsConstructor; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.shardingsphere.infra.metadata.database.schema.decorator.model.ShardingSphereView; import org.apache.shardingsphere.infra.util.yaml.YamlEngine; import org.apache.shardingsphere.infra.yaml.schema.pojo.YamlShardingSphereView; diff --git a/pom.xml b/pom.xml index af72400708b8c..05dba9cfa79ae 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 4.9.2 1.33 2.9.1 - 4.0.3 + 4.0.5 2.3.0 1.3.2 @@ -79,9 +79,9 @@ 1.1 - 3.6.0 - 5.1.0 - 0.5.10 + 3.8.0 + 5.3.0 + 0.7.3 3.0.1 @@ -110,12 +110,13 @@ 2.1.214 6.1.7.jre8-preview - 3.4.2 + 4.0.3 2.2.0 - 4.13.2 + 5.9.1 + 4.13.2 1.3 - 4.5.1 + 4.8.0 3.8.0 @@ -123,7 +124,7 @@ 3.3.0 3.3.0 3.2.0 - 2.18.1 + 3.0.0-M7 2.8.2 3.0.0-M6 3.3.0 @@ -151,7 +152,7 @@ 4.9.10 2.3.31 2.22.1 - 2.9.2 + 2.9.3 @@ -612,7 +613,13 @@ junit junit - ${junit.version} + ${junit4.version} + test + + + org.junit.vintage + junit-vintage-engine + ${junit5.version} test @@ -709,6 +716,10 @@ junit junit + + org.junit.vintage + junit-vintage-engine + org.hamcrest hamcrest-library @@ -774,6 +785,7 @@ maven-surefire-plugin + ${maven-surefire-plugin.version} false diff --git a/test/common/pom.xml b/test/common/pom.xml index 02394fe5699d1..b23dd5fa19ff5 100644 --- a/test/common/pom.xml +++ b/test/common/pom.xml @@ -42,5 +42,10 @@ junit compile + + org.junit.vintage + junit-vintage-engine + compile + diff --git a/test/parser/pom.xml b/test/parser/pom.xml index 591e8e052b1d6..121e1c771d5b6 100644 --- a/test/parser/pom.xml +++ b/test/parser/pom.xml @@ -107,6 +107,11 @@ junit compile + + org.junit.vintage + junit-vintage-engine + compile + org.apache.shardingsphere shardingsphere-test-common From a609ff478bd92462d6a13fabce256155584f2095 Mon Sep 17 00:00:00 2001 From: linghengqian Date: Thu, 13 Oct 2022 13:20:23 +0800 Subject: [PATCH 2/4] Update other library to serve unit testing inside GraalVM Native Image --- .github/workflows/test-myself.yml | 45 ---------------- .../ServerErrorMessageBuilderTest.java | 8 +-- .../proxy/src/main/release-docs/LICENSE | 54 +++++++++---------- .../shardingsphere-proxy/startup/bin.cn.md | 2 +- .../shardingsphere-proxy/startup/bin.en.md | 2 +- examples/pom.xml | 2 +- .../props/DataSourcePropertiesTest.java | 7 +-- .../api/impl/AbstractPipelineJobAPIImpl.java | 2 +- mode/core/pom.xml | 4 -- .../cluster/etcd/EtcdRepository.java | 10 ++-- pom.xml | 8 +-- ...baseProtocolFrontendEngineFactoryTest.java | 4 +- 12 files changed, 49 insertions(+), 99 deletions(-) delete mode 100644 .github/workflows/test-myself.yml diff --git a/.github/workflows/test-myself.yml b/.github/workflows/test-myself.yml deleted file mode 100644 index d05294c42247d..0000000000000 --- a/.github/workflows/test-myself.yml +++ /dev/null @@ -1,45 +0,0 @@ -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Test Myself - -on: - push: - branches: [ junit-next ] - -jobs: - build: - timeout-minutes: 90 - permissions: - contents: read - packages: write - name: Test Myself on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - fail-fast: false - steps: - - uses: actions/checkout@v2 - - uses: graalvm/setup-graalvm@v1 - with: - version: '22.2.0' - java-version: '17' - components: 'native-image' - github-token: ${{ secrets.GITHUB_TOKEN }} - cache: 'maven' - - name: Test Myself - run: ./mvnw clean install -Prelease -T2C diff --git a/dialect-exception/postgresql/src/test/java/org/apache/shardingsphere/dialect/postgresql/message/ServerErrorMessageBuilderTest.java b/dialect-exception/postgresql/src/test/java/org/apache/shardingsphere/dialect/postgresql/message/ServerErrorMessageBuilderTest.java index 22d98f0a101ec..2951851b37953 100644 --- a/dialect-exception/postgresql/src/test/java/org/apache/shardingsphere/dialect/postgresql/message/ServerErrorMessageBuilderTest.java +++ b/dialect-exception/postgresql/src/test/java/org/apache/shardingsphere/dialect/postgresql/message/ServerErrorMessageBuilderTest.java @@ -18,19 +18,19 @@ package org.apache.shardingsphere.dialect.postgresql.message; import org.apache.shardingsphere.dialect.postgresql.vendor.PostgreSQLVendorError; -import org.junit.Assert; import org.junit.Test; import org.postgresql.util.ServerErrorMessage; import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; public final class ServerErrorMessageBuilderTest { @Test public void assertToServerErrorMessage() { ServerErrorMessage actual = ServerErrorMessageBuilder.build("FATAL", PostgreSQLVendorError.PRIVILEGE_NOT_GRANTED, "foo_user", "foo_db"); - Assert.assertThat(actual.getSeverity(), is("FATAL")); - Assert.assertThat(actual.getSQLState(), is(PostgreSQLVendorError.PRIVILEGE_NOT_GRANTED.getSqlState().getValue())); - Assert.assertThat(actual.getMessage(), is("Access denied for user 'foo_user' to database 'foo_db'")); + assertThat(actual.getSeverity(), is("FATAL")); + assertThat(actual.getSQLState(), is(PostgreSQLVendorError.PRIVILEGE_NOT_GRANTED.getSqlState().getValue())); + assertThat(actual.getMessage(), is("Access denied for user 'foo_user' to database 'foo_db'")); } } diff --git a/distribution/proxy/src/main/release-docs/LICENSE b/distribution/proxy/src/main/release-docs/LICENSE index bec804446880f..a382eaece360c 100644 --- a/distribution/proxy/src/main/release-docs/LICENSE +++ b/distribution/proxy/src/main/release-docs/LICENSE @@ -230,7 +230,7 @@ The text of each license is the standard Apache 2.0 license. commons-exec 1.3: https://github.com/apache/commons-exec, Apache 2.0 commons-io 2.11.0: https://github.com/apache/commons-io, Apache 2.0 commons-lang 2.6: https://github.com/apache/commons-lang, Apache 2.0 - commons-lang3 3.8: https://github.com/apache/commons-lang, Apache 2.0 + commons-lang3 3.12.0: https://github.com/apache/commons-lang, Apache 2.0 commons-logging 1.1.3: https://github.com/apache/commons-logging, Apache 2.0 curator-client 5.3.0: https://github.com/apache/curator, Apache 2.0 curator-framework 5.3.0: https://github.com/apache/curator, Apache 2.0 @@ -241,14 +241,14 @@ The text of each license is the standard Apache 2.0 license. failureaccess 1.0.1: https://github.com/google/guava, Apache 2.0 freemarker 2.3.31: https://freemarker.apache.org/, Apache 2.0 groovy 4.0.5: https://groovy.apache.org/, Apache 2.0 - grpc-api 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-context 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-core 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-grpclb 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-netty 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-protobuf 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-protobuf-lite 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 - grpc-stub 1.39.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-api 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-context 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-core 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-grpclb 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-netty 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-protobuf 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-protobuf-lite 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 + grpc-stub 1.41.0: https://github.com/grpc/grpc-java, Apache 2.0 gson 2.9.1: https://github.com/google/gson, Apache 2.0 guava 30.0-jre: https://github.com/google/guava, Apache 2.0 HikariCP 4.0.3: https://github.com/brettwooldridge/HikariCP, Apache 2.0 @@ -268,22 +268,22 @@ The text of each license is the standard Apache 2.0 license. jsr305 3.0.2: http://findbugs.sourceforge.net/, Apache 2.0 log4j 1.2.17: http://logging.apache.org/log4j/1.2/, Apache 2.0 memory 0.9.0, Apache 2.0 - netty-buffer 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-codec 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-codec-dns 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-codec-http 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-codec-http2 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-codec-socks 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-common 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-handler 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-handler-proxy 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-resolver 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-resolver-dns 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-transport 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-transport-classes-epoll 4.1.80.Final: https://github.com/netty, Apache 2.0 - netty-transport-native-epoll 4.1.80.Final-linux-aarch_64: https://github.com/netty, Apache 2.0 - netty-transport-native-epoll 4.1.80.Final-linux-x86_64: https://github.com/netty, Apache 2.0 - netty-transport-native-unix-common 4.1.80.Final: https://github.com/netty, Apache 2.0 + netty-buffer 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-codec 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-codec-dns 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-codec-http 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-codec-http2 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-codec-socks 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-common 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-handler 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-handler-proxy 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-resolver 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-resolver-dns 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-transport 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-transport-classes-epoll 4.1.84.Final: https://github.com/netty, Apache 2.0 + netty-transport-native-epoll 4.1.84.Final-linux-aarch_64: https://github.com/netty, Apache 2.0 + netty-transport-native-epoll 4.1.84.Final-linux-x86_64: https://github.com/netty, Apache 2.0 + netty-transport-native-unix-common 4.1.84.Final: https://github.com/netty, Apache 2.0 perfmark-api 0.23.0: https://github.com/perfmark/perfmark, Apache 2.0 proto-google-common-protos 2.0.1: https://github.com/googleapis/common-protos-java, Apache 2.0 proj4j 1.1.5: https://github.com/locationtech/proj4j, Apache 2.0 @@ -344,8 +344,8 @@ EPL licenses The following components are provided under the EPL License. See project link for details. The text of each license is also included at licenses/LICENSE-[project].txt. - logback-classic 1.2.10: https://github.com/qos-ch/logback, EPL 1.0 - logback-core 1.2.10: https://github.com/qos-ch/logback, EPL 1.0 + logback-classic 1.2.11: https://github.com/qos-ch/logback, EPL 1.0 + logback-core 1.2.11: https://github.com/qos-ch/logback, EPL 1.0 mchange-commons-java 0.2.15: https://github.com/swaldman/mchange-commons-java, EPL 1.0 h2 2.1.214: https://github.com/h2database/h2database, EPL 1.0 diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.cn.md index 81d281e38de46..8343d03987534 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.cn.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.cn.md @@ -40,7 +40,7 @@ ShardingSphere-Proxy 支持配置多个逻辑数据源,每个以 `config-` 前 ShardingSphere-Proxy 默认集成 ZooKeeper Curator 客户端,集群模式使用 ZooKeeper 无须引入其他依赖。 -如果集群模式使用 Etcd,需要将 Etcd 的客户端驱动程序 [jetcd-core 0.5.0](https://repo1.maven.org/maven2/io/etcd/jetcd-core/0.5.0/jetcd-core-0.5.0.jar) 复制至目录 `ext-lib`。 +如果集群模式使用 Etcd,需要将 Etcd 的客户端驱动程序 [jetcd-core 0.5.11](https://repo1.maven.org/maven2/io/etcd/jetcd-core/0.5.11/jetcd-core-0.5.11.jar) 复制至目录 `ext-lib`。 6. (可选)引入分布式事务所需依赖 diff --git a/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.en.md b/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.en.md index 7469409997325..b6dcb70797038 100644 --- a/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.en.md +++ b/docs/document/content/user-manual/shardingsphere-proxy/startup/bin.en.md @@ -41,7 +41,7 @@ If the backend is connected to a MySQL database, please download [mysql-connecto ShardingSphere-Proxy integrates the ZooKeeper Curator client by default. ZooKeeper is used in cluster mode without introducing other dependencies. -If the cluster mode uses Etcd, the client drivers of Etcd [jetcd-core 0.5.0](https://repo1.maven.org/maven2/io/etcd/jetcd-core/0.5.0/jetcd-core-0.5.0.jar) need to be copied into the `ext-lib` directory. +If the cluster mode uses Etcd, the client drivers of Etcd [jetcd-core 0.5.11](https://repo1.maven.org/maven2/io/etcd/jetcd-core/0.5.11/jetcd-core-0.5.11.jar) need to be copied into the `ext-lib` directory. 6. Introduce dependencies required by distributed transactions (Optional) diff --git a/examples/pom.xml b/examples/pom.xml index 99e1f3f94ffa9..7976215b962e4 100644 --- a/examples/pom.xml +++ b/examples/pom.xml @@ -373,7 +373,7 @@ junit junit - ${junit.version} + ${junit4.version} provided diff --git a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java b/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java index 83c4a069fc258..f902bd5eb4cd8 100644 --- a/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java +++ b/infra/common/src/test/java/org/apache/shardingsphere/infra/datasource/props/DataSourcePropertiesTest.java @@ -18,9 +18,7 @@ package org.apache.shardingsphere.infra.datasource.props; import org.apache.shardingsphere.test.mock.MockedDataSource; -import org.junit.Rule; import org.junit.Test; -import org.junit.rules.ExpectedException; import java.util.Arrays; import java.util.HashMap; @@ -32,16 +30,13 @@ import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.not; +import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNull; -import static org.hamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertTrue; public final class DataSourcePropertiesTest { - @Rule - public ExpectedException thrown = ExpectedException.none(); - @SuppressWarnings("unchecked") @Test public void assertGetDataSourceConfigurationWithConnectionInitSqls() { diff --git a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java index b519298f5aa07..7657e4f969ce6 100644 --- a/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java +++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/api/impl/AbstractPipelineJobAPIImpl.java @@ -19,7 +19,7 @@ import com.google.common.base.Preconditions; import lombok.extern.slf4j.Slf4j; -import org.apache.commons.lang.exception.ExceptionUtils; +import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.shardingsphere.data.pipeline.api.config.job.PipelineJobConfiguration; import org.apache.shardingsphere.data.pipeline.api.config.job.yaml.YamlPipelineJobConfiguration; import org.apache.shardingsphere.data.pipeline.api.job.PipelineJobId; diff --git a/mode/core/pom.xml b/mode/core/pom.xml index 711718cd3a621..7b3cbe33c659c 100644 --- a/mode/core/pom.xml +++ b/mode/core/pom.xml @@ -46,9 +46,5 @@ ${project.version} test - - org.apache.commons - commons-lang3 - diff --git a/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java b/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java index d4a3d0427cc92..122f5d85bd035 100644 --- a/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java +++ b/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java @@ -17,17 +17,19 @@ package org.apache.shardingsphere.mode.repository.cluster.etcd; +import com.google.common.base.Preconditions; import com.google.common.base.Splitter; import io.etcd.jetcd.ByteSequence; import io.etcd.jetcd.Client; import io.etcd.jetcd.KeyValue; -import io.etcd.jetcd.Util; import io.etcd.jetcd.Watch; import io.etcd.jetcd.options.DeleteOption; import io.etcd.jetcd.options.GetOption; +import io.etcd.jetcd.options.OptionsUtil; import io.etcd.jetcd.options.PutOption; import io.etcd.jetcd.options.WatchOption; import io.etcd.jetcd.support.Observers; +import io.etcd.jetcd.support.Util; import io.etcd.jetcd.watch.WatchEvent; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; @@ -206,8 +208,10 @@ public void watch(final String key, final DataChangedEventListener dataChangedEv } } }); - client.getWatchClient().watch(ByteSequence.from(key, StandardCharsets.UTF_8), - WatchOption.newBuilder().withPrefix(ByteSequence.from(key, StandardCharsets.UTF_8)).build(), listener); + ByteSequence prefix = ByteSequence.from(key, StandardCharsets.UTF_8); + Preconditions.checkNotNull(prefix, "prefix should not be null"); + client.getWatchClient().watch(prefix, + WatchOption.newBuilder().withRange(OptionsUtil.prefixEndOf(prefix)).build(), listener); } private Type getEventChangedType(final WatchEvent event) { diff --git a/pom.xml b/pom.xml index 05dba9cfa79ae..d6a1af05d105e 100644 --- a/pom.xml +++ b/pom.xml @@ -60,7 +60,7 @@ org.apache.shardingsphere.dependencies 30.0-jre - 3.8 + 3.12.0 4.4 1.15 @@ -75,13 +75,13 @@ 1.32.0 4.3.3 - 4.1.80.Final + 4.1.84.Final 1.1 3.8.0 5.3.0 - 0.7.3 + 0.5.11 3.0.1 @@ -99,7 +99,7 @@ 1.3.0-alpha 1.7.36 - 1.2.10 + 1.2.11 1.18.20 diff --git a/proxy/frontend/reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/ReactiveDatabaseProtocolFrontendEngineFactoryTest.java b/proxy/frontend/reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/ReactiveDatabaseProtocolFrontendEngineFactoryTest.java index 39daacf658e96..6d6296fc4064c 100644 --- a/proxy/frontend/reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/ReactiveDatabaseProtocolFrontendEngineFactoryTest.java +++ b/proxy/frontend/reactive-core/src/test/java/org/apache/shardingsphere/proxy/frontend/reactive/protocol/ReactiveDatabaseProtocolFrontendEngineFactoryTest.java @@ -19,16 +19,16 @@ import org.apache.shardingsphere.proxy.frontend.reactive.protocol.fixture.DummyReactiveDatabaseProtocolFrontendEngine; import org.apache.shardingsphere.infra.util.spi.exception.ServiceProviderNotFoundServerException; -import org.junit.Assert; import org.junit.Test; import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.MatcherAssert.assertThat; public final class ReactiveDatabaseProtocolFrontendEngineFactoryTest { @Test public void assertNewInstance() { - Assert.assertThat(ReactiveDatabaseProtocolFrontendEngineFactory.newInstance("Dummy"), instanceOf(DummyReactiveDatabaseProtocolFrontendEngine.class)); + assertThat(ReactiveDatabaseProtocolFrontendEngineFactory.newInstance("Dummy"), instanceOf(DummyReactiveDatabaseProtocolFrontendEngine.class)); } @Test(expected = ServiceProviderNotFoundServerException.class) From ab9abe9948d640555b303d64d617ba8321470bee Mon Sep 17 00:00:00 2001 From: linghengqian Date: Fri, 14 Oct 2022 11:47:53 +0800 Subject: [PATCH 3/4] Update the handling of GHA's new cache --- .github/workflows/check.yml | 4 ++-- .github/workflows/ci.yml | 8 ++++---- .github/workflows/docker-release.yml | 4 ++-- .github/workflows/it-scaling.yml | 10 +++------- .github/workflows/it-transaction.yml | 5 ++--- .github/workflows/it.yml | 15 +++++++-------- .github/workflows/nightly-build.yml | 5 ++--- .github/workflows/nightly-ci.yml | 5 ++--- .../workflows/nightly-it-example-generator.yml | 5 ++--- 9 files changed, 26 insertions(+), 35 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f65cec69e3178..3eecc6019e056 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -53,9 +53,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-${{ hashFiles('**/pom.xml') }} + key: shardingsphere-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Run checkstyle run: ./mvnw checkstyle:check -T1C diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3ce42668b857b..6964825af7b3e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,9 +68,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-${{ hashFiles('**/pom.xml') }} + key: shardingsphere-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Maven resolve ranges run: ./mvnw versions:resolve-ranges -ntp -Dincludes='org.springframework:*,org.springframework.boot:*' - name: Build prod with Maven @@ -88,9 +88,9 @@ jobs: uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - uses: actions/setup-java@v3 with: distribution: 'temurin' diff --git a/.github/workflows/docker-release.yml b/.github/workflows/docker-release.yml index d8460dff2ac13..1d409667c4105 100644 --- a/.github/workflows/docker-release.yml +++ b/.github/workflows/docker-release.yml @@ -41,9 +41,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-${{ hashFiles('**/pom.xml') }} + key: shardingsphere-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - uses: actions/setup-java@v3 with: distribution: 'temurin' diff --git a/.github/workflows/it-scaling.yml b/.github/workflows/it-scaling.yml index e17407f1b5769..19b3661503b24 100644 --- a/.github/workflows/it-scaling.yml +++ b/.github/workflows/it-scaling.yml @@ -84,10 +84,9 @@ jobs: uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-it-cache-${{ github.sha }} + key: shardingsphere-it-cache-${{ github.sha }} restore-keys: | - shardingsphere-maven-third-party-it-cache- - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Set up JDK 8 uses: actions/setup-java@v3 with: @@ -117,10 +116,7 @@ jobs: uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-it-cache-${{ github.sha }} - restore-keys: | - shardingsphere-maven-third-party-it-cache- - shardingsphere-maven-third-party- + key: shardingsphere-it-cache-${{ github.sha }} - name: Set up JDK 8 uses: actions/setup-java@v3 with: diff --git a/.github/workflows/it-transaction.yml b/.github/workflows/it-transaction.yml index a494a08501c48..8aa22fe33fcd7 100644 --- a/.github/workflows/it-transaction.yml +++ b/.github/workflows/it-transaction.yml @@ -73,10 +73,9 @@ jobs: uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-it-cache${{ github.sha }} + key: shardingsphere-it-cache-${{ github.sha }} restore-keys: | - shardingsphere-maven-third-party-it-cache - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Set up JDK 8 uses: actions/setup-java@v3 with: diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml index d567d4015f1ae..c99f7552374ee 100644 --- a/.github/workflows/it.yml +++ b/.github/workflows/it.yml @@ -76,10 +76,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-it-cache-${{ github.sha }} + key: shardingsphere-it-cache-${{ github.sha }} restore-keys: | - shardingsphere-maven-third-party-it-cache- - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Maven resolve ranges run: ./mvnw versions:resolve-ranges -ntp -Dincludes='org.springframework:*,org.springframework.boot:*' - name: Build IT image @@ -109,7 +108,7 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-it-cache-${{ github.sha }} + key: shardingsphere-it-cache-${{ github.sha }} - uses: actions/setup-java@v3 with: distribution: 'temurin' @@ -146,7 +145,7 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-it-cache-${{ github.sha }} + key: shardingsphere-it-cache-${{ github.sha }} - uses: actions/setup-java@v3 with: distribution: 'temurin' @@ -183,7 +182,7 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-it-cache-${{ github.sha }} + key: shardingsphere-it-cache-${{ github.sha }} - uses: actions/setup-java@v3 with: distribution: 'temurin' @@ -212,9 +211,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-${{ hashFiles('**/pom.xml') }} + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Maven resolve ranges run: ./mvnw versions:resolve-ranges -ntp -Dincludes='org.springframework:*,org.springframework.boot:*' - name: Build Project diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml index 20a98b8c0167b..5e995883bb4c8 100644 --- a/.github/workflows/nightly-build.yml +++ b/.github/workflows/nightly-build.yml @@ -33,10 +33,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-cache-${{ github.sha }} + key: shardingsphere-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party-cache- - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - uses: actions/checkout@v3 - uses: actions/setup-java@v3 with: diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml index 0d0804c5ea9bf..d0a1bdfa6cbc3 100644 --- a/.github/workflows/nightly-ci.yml +++ b/.github/workflows/nightly-ci.yml @@ -47,10 +47,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-cache-${{ github.sha }} + key: shardingsphere-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party-cache- - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Build prod with Maven run: ./mvnw -T1C -B -ntp clean install - name: Build examples with Maven diff --git a/.github/workflows/nightly-it-example-generator.yml b/.github/workflows/nightly-it-example-generator.yml index 1c16cb1e9254e..297476c552d8f 100644 --- a/.github/workflows/nightly-it-example-generator.yml +++ b/.github/workflows/nightly-it-example-generator.yml @@ -59,10 +59,9 @@ jobs: - uses: actions/cache@v3 with: path: ~/.m2/repository - key: shardingsphere-maven-third-party-cache-${{ github.sha }} + key: shardingsphere-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | - shardingsphere-maven-third-party-cache- - shardingsphere-maven-third-party- + ${{ runner.os }}-maven- - name: Maven resolve ranges run: ./mvnw versions:resolve-ranges -ntp -Dincludes='org.springframework:*,org.springframework.boot:*' - name: Build with Maven From 6e22b376bf5a185989e8f1cc0248c3627e9167b7 Mon Sep 17 00:00:00 2001 From: linghengqian Date: Fri, 14 Oct 2022 12:00:10 +0800 Subject: [PATCH 4/4] fix the error in EtcdRepository --- .../mode/repository/cluster/etcd/EtcdRepository.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java b/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java index 122f5d85bd035..7b0b676a87000 100644 --- a/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java +++ b/mode/type/cluster/repository/provider/etcd/src/main/java/org/apache/shardingsphere/mode/repository/cluster/etcd/EtcdRepository.java @@ -22,6 +22,7 @@ import io.etcd.jetcd.ByteSequence; import io.etcd.jetcd.Client; import io.etcd.jetcd.KeyValue; +import io.etcd.jetcd.Util; import io.etcd.jetcd.Watch; import io.etcd.jetcd.options.DeleteOption; import io.etcd.jetcd.options.GetOption; @@ -29,7 +30,6 @@ import io.etcd.jetcd.options.PutOption; import io.etcd.jetcd.options.WatchOption; import io.etcd.jetcd.support.Observers; -import io.etcd.jetcd.support.Util; import io.etcd.jetcd.watch.WatchEvent; import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j;