Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid using hardcoded ports in nativeTest #30003

Merged
merged 1 commit into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions distribution/proxy-native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@
<arg>-J-Xmx7g</arg>
<arg>-H:+AddAllCharsets</arg>
</buildArgs>
<metadataRepository>
<enabled>true</enabled>
<version>0.3.5</version>
</metadataRepository>
</configuration>
<executions>
<execution>
Expand Down
36 changes: 18 additions & 18 deletions distribution/proxy/src/main/release-docs/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -265,29 +265,29 @@ The text of each license is the standard Apache 2.0 license.
jackson-datatype-jdk8 2.16.0: http://github.com/FasterXML/jackson-modules-java8, Apache 2.0
jackson-datatype-jsr310 2.16.0: http://github.com/FasterXML/jackson, Apache 2.0
jcl-over-slf4j 1.7.36: https://github.com/qos-ch/slf4j, Apache 2.0
jetcd-api 0.7.6: https://github.com/etcd-io/jetcd, Apache 2.0
jetcd-common 0.7.6: https://github.com/etcd-io/jetcd, Apache 2.0
jetcd-core 0.7.6: https://github.com/etcd-io/jetcd, Apache 2.0
jetcd-grpc 0.7.6: https://github.com/etcd-io/jetcd, Apache 2.0
jetcd-api 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0
jetcd-common 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0
jetcd-core 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0
jetcd-grpc 0.7.7: https://github.com/etcd-io/jetcd, Apache 2.0
json-path 2.9.0: https://github.com/jayway/JsonPath, Apache 2.0
json-smart 2.4.10: https://www.minidev.net/, Apache 2.0
json-simple 1.1.1: https://code.google.com/archive/p/json-simple/, Apache 2.0
jsr305 3.0.2: http://findbugs.sourceforge.net/, Apache 2.0
memory 0.9.0, Apache 2.0
netty-buffer 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-codec 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-codec-http 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-codec-http2 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-codec-socks 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-common 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-handler 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-handler-proxy 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-resolver 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-transport 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-transport-classes-epoll 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-transport-native-epoll 4.1.99.Final-linux-aarch_64: https://github.com/netty, Apache 2.0
netty-transport-native-epoll 4.1.99.Final-linux-x86_64: https://github.com/netty, Apache 2.0
netty-transport-native-unix-common 4.1.99.Final: https://github.com/netty, Apache 2.0
netty-buffer 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-codec 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-codec-http 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-codec-http2 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-codec-socks 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-common 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-handler 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-handler-proxy 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-resolver 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-transport 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-transport-classes-epoll 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-transport-native-epoll 4.1.106.Final-linux-aarch_64: https://github.com/netty, Apache 2.0
netty-transport-native-epoll 4.1.106.Final-linux-x86_64: https://github.com/netty, Apache 2.0
netty-transport-native-unix-common 4.1.106.Final: https://github.com/netty, Apache 2.0
netty-tcnative-boringssl-static 2.0.59.Final: https://github.com/netty/netty-tcnative, Apache 2.0
netty-tcnative-boringssl-static 2.0.59.Final-linux-aarch_64: https://github.com/netty/netty-tcnative, Apache 2.0
netty-tcnative-boringssl-static 2.0.59.Final-linux-x86_64: https://github.com/netty/netty-tcnative, Apache 2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ ShardingSphere JDBC 要求在如下或更高版本的 `GraalVM CE` 完成构建
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.28</version>
<version>0.10.0</version>
<extensions>true</extensions>
<configuration>
<buildArgs>
<buildArg>-H:+AddAllCharsets</buildArg>
</buildArgs>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -76,7 +73,7 @@ ShardingSphere JDBC 要求在如下或更高版本的 `GraalVM CE` 完成构建

```groovy
plugins {
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'org.graalvm.buildtools.native' version '0.10.0'
}

dependencies {
Expand All @@ -92,9 +89,6 @@ graalvmNative {
buildArgs.add('-H:+AddAllCharsets')
}
}
metadataRepository {
enabled = true
}
}
```

Expand Down Expand Up @@ -240,8 +234,8 @@ ShardingSphere 定义了 `nativeTestInShardingSphere` 的 Maven Profile 用于
sudo apt install unzip zip curl sed -y
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 21.0.1-graalce
sdk use java 21.0.1-graalce
sdk install java 21.0.2-graalce
sdk use java 21.0.2-graalce
sudo apt-get install build-essential libz-dev zlib1g-dev -y

git clone git@github.com:apache/shardingsphere.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@ and the documentation of GraalVM Native Build Tools shall prevail.
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.28</version>
<version>0.10.0</version>
<extensions>true</extensions>
<configuration>
<buildArgs>
<buildArg>-H:+AddAllCharsets</buildArg>
</buildArgs>
<metadataRepository>
<enabled>true</enabled>
</metadataRepository>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -79,7 +76,7 @@ and the documentation of GraalVM Native Build Tools shall prevail.

```groovy
plugins {
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'org.graalvm.buildtools.native' version '0.10.0'
}

dependencies {
Expand All @@ -95,9 +92,6 @@ graalvmNative {
buildArgs.add('-H:+AddAllCharsets')
}
}
metadataRepository {
enabled = true
}
}
```

Expand Down Expand Up @@ -250,8 +244,8 @@ You must install Docker Engine to execute `testcontainers-java` related unit tes
sudo apt install unzip zip curl sed -y
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 21.0.1-graalce
sdk use java 21.0.1-graalce
sdk install java 21.0.2-graalce
sdk use java 21.0.2-graalce
sudo apt-get install build-essential libz-dev zlib1g-dev -y

git clone git@github.com:apache/shardingsphere.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ShardingSphere-Proxy 支持配置多个逻辑数据源,每个以 `config-` 前

ShardingSphere-Proxy 默认集成 ZooKeeper Curator 客户端,集群模式使用 ZooKeeper 无须引入其他依赖。

如果集群模式使用 Etcd,需要将 Etcd 依赖的 [vertx-grpc 4.4.4](https://repo1.maven.org/maven2/io/vertx/vertx-grpc/4.4.4/vertx-grpc-4.4.4.jar) 和 [vertx-core 4.4.4](https://repo1.maven.org/maven2/io/vertx/vertx-core/4.4.4/vertx-core-4.4.4.jar) 复制至目录 `ext-lib`。
如果集群模式使用 Etcd,需要将 Etcd 依赖的 [vertx-grpc 4.5.1](https://repo1.maven.org/maven2/io/vertx/vertx-grpc/4.5.1/vertx-grpc-4.5.1.jar) 和 [vertx-core 4.5.1](https://repo1.maven.org/maven2/io/vertx/vertx-core/4.5.1/vertx-core-4.5.1.jar) 复制至目录 `ext-lib`。

6. (可选)引入分布式事务所需依赖

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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, please copy [vertx-grpc 4.4.4](https://repo1.maven.org/maven2/io/vertx/vertx-grpc/4.4.4/vertx-grpc-4.4.4.jar) and [vertx-core 4.4.4](https://repo1.maven.org/maven2/io/vertx/vertx-core/4.4.4/vertx-core-4.4.4.jar) that Etcd depends on into the `ext-lib` directory.
If the cluster mode uses Etcd, please copy [vertx-grpc 4.5.1](https://repo1.maven.org/maven2/io/vertx/vertx-grpc/4.5.1/vertx-grpc-4.5.1.jar) and [vertx-core 4.5.1](https://repo1.maven.org/maven2/io/vertx/vertx-core/4.5.1/vertx-core-4.5.1.jar) that Etcd depends on into the `ext-lib` directory.

6. Introduce dependencies required by distributed transactions (Optional)

Expand Down
12 changes: 4 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@
<jboss-logging.version>3.2.1.Final</jboss-logging.version>
<seata.version>1.6.1</seata.version>

<netty.version>4.1.99.Final</netty.version>
<netty.version>4.1.106.Final</netty.version>
<bouncycastle.version>1.70</bouncycastle.version>

<curator.version>5.6.0</curator.version>
<zookeeper.version>3.9.1</zookeeper.version>
<audience-annotations.version>0.12.0</audience-annotations.version>
<jetcd.version>0.7.6</jetcd.version>
<vertx.version>4.4.4</vertx.version>
<jetcd.version>0.7.7</jetcd.version>
<vertx.version>4.5.1</vertx.version>
<consul.api.version>1.4.5</consul.api.version>

<grpc.version>1.58.0</grpc.version>
Expand Down Expand Up @@ -153,7 +153,7 @@
<dockerfile-maven.version>1.4.13</dockerfile-maven.version>
<docker-compose-maven-plugin.version>4.0.0</docker-compose-maven-plugin.version>
<os-maven-plugin.version>1.6.2</os-maven-plugin.version>
<native-maven-plugin.version>0.9.28</native-maven-plugin.version>
<native-maven-plugin.version>0.10.0</native-maven-plugin.version>

<!-- Compile plugin versions -->
<templating-maven-plugin.version>1.0.0</templating-maven-plugin.version>
Expand Down Expand Up @@ -1067,10 +1067,6 @@
<buildArg>-H:+AddAllCharsets</buildArg>
</buildArgs>
<quickBuild>true</quickBuild>
<metadataRepository>
<enabled>true</enabled>
<version>0.3.5</version>
</metadataRepository>
</configuration>
<executions>
<execution>
Expand Down
11 changes: 11 additions & 0 deletions test/native/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,17 @@
<artifactId>mssqlserver</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-test</artifactId>
<version>${jetcd.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@

package org.apache.shardingsphere.test.natived.jdbc.databases;

import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.test.natived.jdbc.commons.TestShardingService;
import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;

import javax.sql.DataSource;
import java.io.IOException;
import java.sql.SQLException;

@EnabledInNativeImage
class MSSQLServerTest {

private TestShardingService testShardingService;

@Test
@EnabledInNativeImage
void assertShardingInLocalTransactions() throws SQLException, IOException {
DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/databases/mssqlserver.yaml"));
void assertShardingInLocalTransactions() throws SQLException {
HikariConfig config = new HikariConfig();
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/databases/mssqlserver.yaml");
DataSource dataSource = new HikariDataSource(config);
testShardingService = new TestShardingService(dataSource);
this.initEnvironment();
testShardingService.processSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,26 @@

package org.apache.shardingsphere.test.natived.jdbc.databases;

import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.test.natived.jdbc.commons.TestShardingService;
import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.EnabledInNativeImage;

import javax.sql.DataSource;
import java.io.IOException;
import java.sql.SQLException;

@EnabledInNativeImage
class PostgresTest {

private TestShardingService testShardingService;

@Test
@EnabledInNativeImage
void assertShardingInLocalTransactions() throws SQLException, IOException {
DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/databases/postgresql.yaml"));
void assertShardingInLocalTransactions() throws SQLException {
HikariConfig config = new HikariConfig();
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/databases/postgresql.yaml");
DataSource dataSource = new HikariDataSource(config);
testShardingService = new TestShardingService(dataSource);
this.initEnvironment();
testShardingService.processSuccess();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@

package org.apache.shardingsphere.test.natived.jdbc.features;

import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
import org.apache.shardingsphere.test.natived.jdbc.commons.FileTestUtils;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Address;
import org.apache.shardingsphere.test.natived.jdbc.commons.entity.Order;
import org.apache.shardingsphere.test.natived.jdbc.commons.entity.OrderItem;
Expand All @@ -28,7 +28,6 @@
import org.junit.jupiter.api.Test;

import javax.sql.DataSource;
import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -48,8 +47,11 @@ class EncryptTest {
private AddressRepository addressRepository;

@Test
void assertEncryptInLocalTransactions() throws SQLException, IOException {
DataSource dataSource = YamlShardingSphereDataSourceFactory.createDataSource(FileTestUtils.readFromFileURLString("test-native/yaml/features/encrypt.yaml"));
void assertEncryptInLocalTransactions() throws SQLException {
HikariConfig config = new HikariConfig();
config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver");
config.setJdbcUrl("jdbc:shardingsphere:classpath:test-native/yaml/features/encrypt.yaml");
DataSource dataSource = new HikariDataSource(config);
orderRepository = new OrderRepository(dataSource);
orderItemRepository = new OrderItemRepository(dataSource);
addressRepository = new AddressRepository(dataSource);
Expand Down
Loading
Loading