Skip to content

Commit e0d4770

Browse files
committed
Refactor Firebird's nativeTest
1 parent ae9c2ca commit e0d4770

17 files changed

Lines changed: 161 additions & 116 deletions

File tree

docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ShardingSphere 对 ClickHouse JDBC Driver 的支持位于可选模块中。
4343
```yaml
4444
services:
4545
clickhouse-server:
46-
image: clickhouse/clickhouse-server:25.6.5.41
46+
image: clickhouse/clickhouse-server:25.9.6.117
4747
environment:
4848
CLICKHOUSE_SKIP_USER_SETUP: "1"
4949
ports:

docs/document/content/user-manual/shardingsphere-jdbc/optional-plugins/clickhouse/_index.en.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Write a Docker Compose file to start ClickHouse.
4343
```yaml
4444
services:
4545
clickhouse-server:
46-
image: clickhouse/clickhouse-server:25.6.5.41
46+
image: clickhouse/clickhouse-server:25.9.6.117
4747
environment:
4848
CLICKHOUSE_SKIP_USER_SETUP: "1"
4949
ports:

infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reachability-metadata.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11690,6 +11690,18 @@
1169011690
},
1169111691
"glob": "current-git-commit.properties"
1169211692
},
11693+
{
11694+
"condition": {
11695+
"typeReached": "org.apache.shardingsphere.driver.jdbc.core.statement.StatementManager"
11696+
},
11697+
"glob": "isc_error_msg.properties"
11698+
},
11699+
{
11700+
"condition": {
11701+
"typeReached": "org.apache.shardingsphere.driver.jdbc.core.statement.StatementManager"
11702+
},
11703+
"glob": "isc_error_sqlstates.properties"
11704+
},
1169311705
{
1169411706
"condition": {
1169511707
"typeReached": "org.apache.shardingsphere.transaction.xa.atomikos.manager.AtomikosTransactionManagerProvider"
@@ -11702,6 +11714,18 @@
1170211714
},
1170311715
"glob": "lib/sqlparser/druid.jar"
1170411716
},
11717+
{
11718+
"condition": {
11719+
"typeReached": "org.apache.shardingsphere.driver.jdbc.core.statement.StatementManager"
11720+
},
11721+
"glob": "org/firebirdsql/jaybird_error_msg.properties"
11722+
},
11723+
{
11724+
"condition": {
11725+
"typeReached": "org.apache.shardingsphere.driver.jdbc.core.statement.StatementManager"
11726+
},
11727+
"glob": "org/firebirdsql/jaybird_error_sqlstates.properties"
11728+
},
1170511729
{
1170611730
"condition": {
1170711731
"typeReached": "org.apache.shardingsphere.transaction.base.seata.at.SeataATShardingSphereTransactionManager"

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@
136136
<hamcrest.version>3.0</hamcrest.version>
137137
<mockito.version>4.11.0</mockito.version>
138138
<awaitility.version>4.3.0</awaitility.version>
139+
<firebird-testcontainers-java.version>1.6.0</firebird-testcontainers-java.version>
139140
<commons-csv.version>1.9.0</commons-csv.version>
140141

141142
<graal-sdk.version>24.1.2</graal-sdk.version>

test/native/pom.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@
136136
<artifactId>clickhouse</artifactId>
137137
<scope>test</scope>
138138
</dependency>
139+
<dependency>
140+
<groupId>org.firebirdsql</groupId>
141+
<artifactId>firebird-testcontainers-java</artifactId>
142+
<version>${firebird-testcontainers-java.version}</version>
143+
<scope>test</scope>
144+
</dependency>
139145
<dependency>
140146
<groupId>org.apache.curator</groupId>
141147
<artifactId>curator-test</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers.jdbcurl;
19+
20+
import org.apache.shardingsphere.database.connector.core.jdbcurl.parser.ConnectionProperties;
21+
import org.apache.shardingsphere.database.connector.core.jdbcurl.parser.ConnectionPropertiesParser;
22+
import org.apache.shardingsphere.database.connector.core.jdbcurl.parser.StandardJdbcUrlParser;
23+
24+
/**
25+
* Connection properties parser of Firebird.
26+
*/
27+
public final class TcFirebirdConnectionPropertiesParser implements ConnectionPropertiesParser {
28+
29+
private static final int DEFAULT_PORT = 3050;
30+
31+
@Override
32+
public ConnectionProperties parse(final String url, final String username, final String catalog) {
33+
return new StandardJdbcUrlParser().parse(url, DEFAULT_PORT);
34+
}
35+
36+
@Override
37+
public String getDatabaseType() {
38+
return "TC-Firebird";
39+
}
40+
}

test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/algorithm/testcontainers/TcClickhouseDatabaseType.java renamed to test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/algorithm/testcontainers/type/TcClickhouseDatabaseType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers;
18+
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers.type;
1919

2020
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
2121
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers.type;
19+
20+
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
21+
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
22+
23+
import java.util.Arrays;
24+
import java.util.Collection;
25+
import java.util.Optional;
26+
27+
/**
28+
* Database type of Firebird in testcontainers.
29+
*/
30+
public final class TcFirebirdDatabaseType implements TestcontainersDatabaseType {
31+
32+
@Override
33+
public Collection<String> getJdbcUrlPrefixes() {
34+
return Arrays.asList("jdbc:tc:firebird:", "jdbc:tc:firebirdsql");
35+
}
36+
37+
@Override
38+
public Optional<DatabaseType> getTrunkDatabaseType() {
39+
return Optional.of(TypedSPILoader.getService(DatabaseType.class, "Firebird"));
40+
}
41+
42+
@Override
43+
public String getType() {
44+
return "TC-Firebird";
45+
}
46+
}

test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/algorithm/testcontainers/TcPostgreSQLDatabaseType.java renamed to test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/algorithm/testcontainers/type/TcPostgreSQLDatabaseType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers;
18+
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers.type;
1919

2020
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
2121
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;

test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/algorithm/testcontainers/TcSQLServerDatabaseType.java renamed to test/native/src/test/java/org/apache/shardingsphere/test/natived/commons/algorithm/testcontainers/type/TcSQLServerDatabaseType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers;
18+
package org.apache.shardingsphere.test.natived.commons.algorithm.testcontainers.type;
1919

2020
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
2121
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;

0 commit comments

Comments
 (0)