This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new d3e9490d466 Added support to TestContainers JDBC URL of Firebird
(#33953)
d3e9490d466 is described below
commit d3e9490d466c25954b2d053c068526474b6fcc0c
Author: Maxim Sentyabrskiy <[email protected]>
AuthorDate: Sat Dec 7 16:27:44 2024 +0300
Added support to TestContainers JDBC URL of Firebird (#33953)
* Added support to TestContainers JDBC URL of Firebird
(apache/shardingsphere/issues/33782)
* apply Spotless formatting
* correct naming
* Spotless formatting after (mvnw spotless:apply -Pcheck)
---
.../type/TcFirebirdDatabaseType.java | 46 ++++++++++++++++++++++
...ingsphere.infra.database.core.type.DatabaseType | 1 +
.../type/TestcontainersDatabaseTypeTest.java | 1 +
3 files changed, 48 insertions(+)
diff --git
a/infra/database/type/testcontainers/src/main/java/org/apache/shardingsphere/infra/database/testcontainers/type/TcFirebirdDatabaseType.java
b/infra/database/type/testcontainers/src/main/java/org/apache/shardingsphere/infra/database/testcontainers/type/TcFirebirdDatabaseType.java
new file mode 100644
index 00000000000..458c444403e
--- /dev/null
+++
b/infra/database/type/testcontainers/src/main/java/org/apache/shardingsphere/infra/database/testcontainers/type/TcFirebirdDatabaseType.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.infra.database.testcontainers.type;
+
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Optional;
+
+/**
+ * Database type of Firebird in testcontainers-java.
+ */
+public final class TcFirebirdDatabaseType implements
TestcontainersDatabaseType {
+
+ @Override
+ public Collection<String> getJdbcUrlPrefixes() {
+ return Collections.singleton("jdbc:tc:firebird:");
+ }
+
+ @Override
+ public Optional<DatabaseType> getTrunkDatabaseType() {
+ return Optional.of(TypedSPILoader.getService(DatabaseType.class,
"Firebird"));
+ }
+
+ @Override
+ public String getType() {
+ return "TC-Firebird";
+ }
+}
diff --git
a/infra/database/type/testcontainers/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType
b/infra/database/type/testcontainers/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType
index bf2f8488897..152c14c8490 100644
---
a/infra/database/type/testcontainers/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType
+++
b/infra/database/type/testcontainers/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType
@@ -22,3 +22,4 @@
org.apache.shardingsphere.infra.database.testcontainers.type.TcOracleDatabaseTyp
org.apache.shardingsphere.infra.database.testcontainers.type.TcPostgreSQLDatabaseType
org.apache.shardingsphere.infra.database.testcontainers.type.TcSQLServerDatabaseType
org.apache.shardingsphere.infra.database.testcontainers.type.TcTiDBDatabaseType
+org.apache.shardingsphere.infra.database.testcontainers.type.TcFirebirdDatabaseType
diff --git
a/infra/database/type/testcontainers/src/test/java/org/apache/shardingsphere/infra/database/testcontainers/type/TestcontainersDatabaseTypeTest.java
b/infra/database/type/testcontainers/src/test/java/org/apache/shardingsphere/infra/database/testcontainers/type/TestcontainersDatabaseTypeTest.java
index c81750acbe1..5ca0a738821 100644
---
a/infra/database/type/testcontainers/src/test/java/org/apache/shardingsphere/infra/database/testcontainers/type/TestcontainersDatabaseTypeTest.java
+++
b/infra/database/type/testcontainers/src/test/java/org/apache/shardingsphere/infra/database/testcontainers/type/TestcontainersDatabaseTypeTest.java
@@ -37,5 +37,6 @@ class TestcontainersDatabaseTypeTest {
assertThat(TypedSPILoader.getService(DatabaseType.class,
"TC-PostgreSQL").getJdbcUrlPrefixes(),
is(Collections.singleton("jdbc:tc:postgresql:")));
assertThat(TypedSPILoader.getService(DatabaseType.class,
"TC-SQLServer").getJdbcUrlPrefixes(),
is(Collections.singleton("jdbc:tc:sqlserver:")));
assertThat(TypedSPILoader.getService(DatabaseType.class,
"TC-TiDB").getJdbcUrlPrefixes(), is(Collections.singleton("jdbc:tc:tidb:")));
+ assertThat(TypedSPILoader.getService(DatabaseType.class,
"TC-Firebird").getJdbcUrlPrefixes(),
is(Collections.singleton("jdbc:tc:firebird:")));
}
}