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 0e219a40d13 Add OpenGaussPipelineSQLBuilderTest (#37427)
0e219a40d13 is described below
commit 0e219a40d136ba34c40ae4e81bfa72611d7f1edb
Author: Liang Zhang <[email protected]>
AuthorDate: Thu Dec 18 20:58:54 2025 +0800
Add OpenGaussPipelineSQLBuilderTest (#37427)
---
.../opengauss/sqlbuilder/OpenGaussPipelineSQLBuilderTest.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git
a/kernel/data-pipeline/dialect/opengauss/src/test/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilderTest.java
b/kernel/data-pipeline/dialect/opengauss/src/test/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilderTest.java
index f73bd4116a0..9db016c9eda 100644
---
a/kernel/data-pipeline/dialect/opengauss/src/test/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilderTest.java
+++
b/kernel/data-pipeline/dialect/opengauss/src/test/java/org/apache/shardingsphere/data/pipeline/opengauss/sqlbuilder/OpenGaussPipelineSQLBuilderTest.java
@@ -32,7 +32,7 @@ import org.junit.jupiter.api.Test;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.Collections;
+import java.util.Arrays;
import java.util.Optional;
import static org.hamcrest.CoreMatchers.is;
@@ -81,14 +81,16 @@ class OpenGaussPipelineSQLBuilderTest {
assertThat(actual.get(), is("SELECT reltuples::integer FROM pg_class
WHERE oid='foo_tbl'::regclass::oid;"));
}
+ @SuppressWarnings("JDBCResourceOpenedButNotSafelyClosed")
@Test
void assertBuildCreateTableSQLs() throws SQLException {
Connection connection = mock(Connection.class, RETURNS_DEEP_STUBS);
ResultSet resultSet = mock(ResultSet.class);
when(resultSet.next()).thenReturn(true);
- when(resultSet.getString("pg_get_tabledef")).thenReturn("CREATE TABLE
foo_tbl (id INT PRIMARY KEY);");
+ when(resultSet.getString("pg_get_tabledef")).thenReturn("CREATE TABLE
foo_tbl (id INT PRIMARY KEY);ALTER TABLE foo_tbl OWNER TO root");
when(connection.createStatement().executeQuery("SELECT * FROM
pg_get_tabledef('foo_schema.foo_tbl')")).thenReturn(resultSet);
- assertThat(sqlBuilder.buildCreateTableSQLs(new
MockedDataSource(connection), "foo_schema", "foo_tbl"),
is(Collections.singletonList("CREATE TABLE foo_tbl (id INT PRIMARY KEY)")));
+ assertThat(sqlBuilder.buildCreateTableSQLs(new
MockedDataSource(connection), "foo_schema", "foo_tbl"),
+ is(Arrays.asList("CREATE TABLE foo_tbl (id INT PRIMARY KEY)",
"ALTER TABLE foo_schema.foo_tbl OWNER TO root")));
}
@Test