You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/07/17 13:25:41 UTC
[GitHub] [shardingsphere] FlyingZC opened a new pull request, #19293: Add transaction IT test demo
FlyingZC opened a new pull request, #19293:
URL: https://github.com/apache/shardingsphere/pull/19293
Fixes #ISSUSE_ID.
Changes proposed in this pull request:
- Add transaction IT test demo, for example `commit and rollback` case;
- [ ] Support both jdbc and proxy mode,currently supports proxy;
- [x] Support MySQL,PostgreSQL,OpenGauss;
- [x] Support local transaction and distributed transaction.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r922951662
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml:
##########
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-integration-test</artifactId>
+ <version>5.1.3-SNAPSHOT</version>
+ </parent>
+ <artifactId>shardingsphere-integration-test-transaction</artifactId>
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ <atomikos.version>5.0.8</atomikos.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-proxy-frontend-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-proxy-bootstrap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-data-pipeline-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
Review Comment:
We need't this dependency, it just for scaling...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r924221806
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/commitrollback/CommitAndRollbackTestCase.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.integration.transaction.cases.commitrollback;
+
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * Commit and rollback transaction integration test.
+ */
+@TransactionTestCase
+public final class CommitAndRollbackTestCase extends BaseTransactionTestCase {
+
+ public CommitAndRollbackTestCase(final DataSource dataSource) {
Review Comment:
Is it same to `BindingTestCase`?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/BaseSavePointTestCase.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Savepoint;
+
+/**
+ * Auto commit transaction integration test.
+ */
Review Comment:
Base save point test case?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/autocommit/AutoCommitTestCase.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.integration.transaction.cases.autocommit;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
+import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.junit.Assert;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase
+public final class AutoCommitTestCase extends BaseTransactionTestCase {
+
+ public AutoCommitTestCase(final DataSource dataSource) {
+ super(dataSource);
+ }
+
+ @Override
+ @SneakyThrows(SQLException.class)
+ public void assertTest() {
+ assertAutoCommit();
+ }
Review Comment:
Maybe need to think of a more appropriate function name.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/MySQLSavePointTestCase.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+
+import javax.sql.DataSource;
+
+/**
+ * MySQL auto commit transaction integration test.
+ */
Review Comment:
MySQL save point test case?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/OpenGaussSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * OpenGauss auto commit transaction integration test.
+ */
Review Comment:
OpenGauss save point test case?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/constants/TransactionTestConstants.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.integration.transaction.engine.constants;
+
+public class TransactionTestConstants {
+
Review Comment:
final
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * PostgreSQL auto commit transaction integration test.
+ */
Review Comment:
PostgreSQL save point test case?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/OpenGaussSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * OpenGauss auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase(dbTypes = {TransactionTestConstants.OPENGAUSS})
+public class OpenGaussSavePointTestCase extends BaseSavePointTestCase {
+
Review Comment:
final
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/MySQLSavePointTestCase.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+
+import javax.sql.DataSource;
+
+/**
+ * MySQL auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL})
+public class MySQLSavePointTestCase extends BaseSavePointTestCase {
+
Review Comment:
final
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * PostgreSQL auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase(dbTypes = {TransactionTestConstants.POSTGRESQL})
+public class PostgreSQLSavePointTestCase extends BaseSavePointTestCase {
Review Comment:
final
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925097474
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussJdbcTransactionIT.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.integration.transaction.engine.opengauss;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * OpenGauss general transaction test case with JDBC container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
For the same reason as above, I will modify it later.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.integration.transaction.engine.opengauss;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * OpenGauss general transaction test case with proxy container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
For the same reason as above, I will modify it later.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLJdbcTransactionIT.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.integration.transaction.engine.postgresql;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * PostgreSQL general transaction test case with JDBC container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
For the same reason as above, I will modify it later.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.integration.transaction.engine.postgresql;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * PostgreSQL general transaction test case with proxy container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
For the same reason as above, I will modify it later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925100437
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * PostgreSQL auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase(dbTypes = {TransactionTestConstants.POSTGRESQL})
+public class PostgreSQLSavePointTestCase extends BaseSavePointTestCase {
Review Comment:
I will correct it.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/OpenGaussSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * OpenGauss auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase(dbTypes = {TransactionTestConstants.OPENGAUSS})
+public class OpenGaussSavePointTestCase extends BaseSavePointTestCase {
+
Review Comment:
I will correct it.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/MySQLSavePointTestCase.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+
+import javax.sql.DataSource;
+
+/**
+ * MySQL auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase(dbTypes = {TransactionTestConstants.MYSQL})
+public class MySQLSavePointTestCase extends BaseSavePointTestCase {
+
Review Comment:
I will correct it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
jingshanglu commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r922946226
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml:
##########
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-integration-test</artifactId>
+ <version>5.1.3-SNAPSHOT</version>
+ </parent>
+ <artifactId>shardingsphere-integration-test-transaction</artifactId>
+ <name>${project.artifactId}</name>
+
+ <properties>
+ <maven.deploy.skip>true</maven.deploy.skip>
+ <atomikos.version>5.0.8</atomikos.version>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-proxy-frontend-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-proxy-bootstrap</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-data-pipeline-core</artifactId>
+ <version>${project.version}</version>
+ </dependency>
Review Comment:
Why do we need this dependency?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussProxyTransactionIT.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.integration.transaction.engine.opengauss;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * OpenGauss general transaction test case with proxy container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
Do I need to uncomment here?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLJdbcTransactionIT.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.integration.transaction.engine.mysql;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * MySQL general transaction test case with JDBC container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
Do I need to uncomment here?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/database/OpenGaussContainer.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.integration.transaction.framework.container.database;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
+import org.apache.shardingsphere.integration.transaction.env.IntegrationTestEnvironment;
+import org.apache.shardingsphere.integration.transaction.env.enums.TransactionITEnvTypeEnum;
+import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
+import org.apache.shardingsphere.test.integration.framework.container.wait.JDBCConnectionWaitStrategy;
+import org.testcontainers.containers.BindMode;
+
+import java.sql.DriverManager;
+
+/**
+ * OpenGauss container for Scaling IT.
+ */
Review Comment:
Transaction?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml:
##########
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-integration-test</artifactId>
+ <version>5.1.3-SNAPSHOT</version>
Review Comment:
Maybe `${project.version}` is better.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/opengauss/OpenGaussJdbcTransactionIT.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.integration.transaction.engine.opengauss;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * OpenGauss general transaction test case with JDBC container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
Do I need to uncomment here?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLJdbcTransactionIT.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.integration.transaction.engine.postgresql;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * PostgreSQL general transaction test case with JDBC container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
Do I need to uncomment here?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/database/DatabaseContainer.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.integration.transaction.framework.container.database;
+
+import lombok.Getter;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.test.integration.framework.container.atomic.DockerITContainer;
+
+/**
+ * Docker storage container.
+ */
+@Getter
+public abstract class DatabaseContainer extends DockerITContainer {
+
+ private final DatabaseType databaseType;
+
+ public DatabaseContainer(final DatabaseType databaseType, final String dockerImageName) {
+ super(databaseType.getType().toLowerCase(), dockerImageName);
+ this.databaseType = databaseType;
+ }
+
+ /**
+ * Get jdbc url.
+ *
+ * @param databaseName database name
+ * @return jdbc url
+ */
+ public abstract String getJdbcUrl(String databaseName);
+
+ /**
+ * Get database username.
+ *
+ * @return database username
+ */
+ public abstract String getUsername();
+
+ /**
+ * Get database password.
+ *
+ * @return database username
+ */
Review Comment:
database password,right?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/postgresql/PostgreSQLProxyTransactionIT.java:
##########
@@ -0,0 +1,49 @@
+/*
+ * 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.integration.transaction.engine.postgresql;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.engine.mysql.MySQLJdbcTransactionIT;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * PostgreSQL general transaction test case with proxy container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
Do I need to uncomment here?
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/IntegrationTestEnvironment.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * 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.integration.transaction.env;
+
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
+import org.apache.shardingsphere.integration.transaction.engine.entity.JdbcInfoEntity;
+import org.apache.shardingsphere.integration.transaction.env.enums.TransactionITEnvTypeEnum;
+import org.apache.shardingsphere.integration.transaction.env.enums.TransactionTestCaseRegistry;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+@Getter
+@Slf4j
+public final class IntegrationTestEnvironment {
+
+ private static final IntegrationTestEnvironment INSTANCE = new IntegrationTestEnvironment();
+
+ private final Properties props;
+
+ private final TransactionITEnvTypeEnum itEnvType;
+
+ private final List<String> mysqlVersions;
+
+ private final List<String> postgresVersions;
+
+ private final List<String> openGaussVersions;
+
+ private final Map<String, TransactionTestCaseRegistry> transactionTestCaseRegistryMap;
+
+ private IntegrationTestEnvironment() {
+ props = loadProperties();
+ itEnvType = TransactionITEnvTypeEnum.valueOf(StringUtils.defaultIfBlank(props.getProperty("transaction.it.env.type").toUpperCase(), TransactionITEnvTypeEnum.NONE.name()));
+ mysqlVersions = splitProperty("transaction.it.docker.mysql.version");
+ postgresVersions = splitProperty("transaction.it.docker.postgresql.version");
+ openGaussVersions = splitProperty("transaction.it.docker.opengauss.version");
+ transactionTestCaseRegistryMap = initTransactionTestCaseRegistryMap();
+ }
+
+ private Map<String, TransactionTestCaseRegistry> initTransactionTestCaseRegistryMap() {
+ final Map<String, TransactionTestCaseRegistry> transactionTestCaseRegistryMap;
+ transactionTestCaseRegistryMap = new HashMap<>(TransactionTestCaseRegistry.values().length, 1);
+ for (TransactionTestCaseRegistry each : TransactionTestCaseRegistry.values()) {
+ transactionTestCaseRegistryMap.put(each.getTestCaseClass().getName(), each);
+ }
+ return transactionTestCaseRegistryMap;
+ }
+
+ private List<String> splitProperty(final String key) {
+ return Arrays.stream(props.getOrDefault(key, "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ }
+
+ private Properties loadProperties() {
+ Properties result = new Properties();
+ try (InputStream inputStream = IntegrationTestEnvironment.class.getClassLoader().getResourceAsStream("env/transaction-it-env.properties")) {
+ result.load(inputStream);
+ } catch (final IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ for (String each : System.getProperties().stringPropertyNames()) {
+ result.setProperty(each, System.getProperty(each));
+ }
+ return result;
+ }
+
+ /**
+ * Get actual data source connection.
+ *
+ * @param databaseType database type.
+ * @return jdbc connection
+ */
+ public JdbcInfoEntity getActualDatabaseJdbcInfo(final DatabaseType databaseType) {
+ String username;
+ String password;
+ int port;
+ switch (databaseType.getType()) {
+ case "MySQL":
+ username = props.getOrDefault("transaction.it.native.mysql.username", "root").toString();
+ password = props.getOrDefault("transaction.it.native.mysql.password", "root").toString();
+ port = Integer.parseInt(props.getOrDefault("transaction.it.native.mysql.port", 3307).toString());
+ break;
+ case "PostgreSQL":
+ username = props.getOrDefault("transaction.it.native.postgresql.username", "postgres").toString();
+ password = props.getOrDefault("transaction.it.native.postgresql.password", "postgres").toString();
+ port = Integer.parseInt(props.getOrDefault("transaction.it.native.postgresql.port", 5432).toString());
+ break;
+ case "openGauss":
+ username = props.getOrDefault("transaction.it.native.opengauss.username", "gaussdb").toString();
+ password = props.getOrDefault("transaction.it.native.opengauss.password", "Root@123").toString();
+ port = Integer.parseInt(props.getOrDefault("transaction.it.native.opengauss.port", 5432).toString());
+ break;
+ default:
+ throw new UnsupportedOperationException("Unsupported database type: " + databaseType.getType());
+ }
+ return new JdbcInfoEntity(username, password, port);
+ }
+
+ /**
+ * Get actual data source default port.
+ *
+ * @param databaseType database type.
+ * @return default port
+ */
+ public int getActualDataSourceDefaultPort(final DatabaseType databaseType) {
+ switch (databaseType.getType()) {
+ case "MySQL":
+ return Integer.parseInt(props.getOrDefault("transaction.it.native.mysql.port", 3306).toString());
+ case "PostgreSQL":
+ return Integer.parseInt(props.getOrDefault("transaction.it.native.postgresql.port", 5432).toString());
+ case "openGauss":
+ return Integer.parseInt(props.getOrDefault("transaction.it.native.opengauss.port", 5432).toString());
+ default:
+ throw new IllegalArgumentException("Unsupported database type: " + databaseType.getType());
+ }
+ }
+
+ /**
+ * Get native database type.
+ *
+ * @return native database type
+ */
+ public String getNativeDatabaseType() {
+ return String.valueOf(props.get("transaction.it.native.database"));
+ }
+
+ /**
+ * Get actual data source username.
+ *
+ * @param databaseType database type.
+ * @return actual data source username
+ */
+ public String getActualDataSourceUsername(final DatabaseType databaseType) {
+ String username;
+ if (databaseType instanceof OpenGaussDatabaseType) {
+ username = "gaussdb";
+ } else {
+ username = "root";
+ }
Review Comment:
Can we put variables in config file?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r922950891
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/env/IntegrationTestEnvironment.java:
##########
@@ -0,0 +1,197 @@
+/*
+ * 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.integration.transaction.env;
+
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
+import org.apache.shardingsphere.integration.transaction.engine.entity.JdbcInfoEntity;
+import org.apache.shardingsphere.integration.transaction.env.enums.TransactionITEnvTypeEnum;
+import org.apache.shardingsphere.integration.transaction.env.enums.TransactionTestCaseRegistry;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+@Getter
+@Slf4j
+public final class IntegrationTestEnvironment {
+
+ private static final IntegrationTestEnvironment INSTANCE = new IntegrationTestEnvironment();
+
+ private final Properties props;
+
+ private final TransactionITEnvTypeEnum itEnvType;
+
+ private final List<String> mysqlVersions;
+
+ private final List<String> postgresVersions;
+
+ private final List<String> openGaussVersions;
+
+ private final Map<String, TransactionTestCaseRegistry> transactionTestCaseRegistryMap;
+
+ private IntegrationTestEnvironment() {
+ props = loadProperties();
+ itEnvType = TransactionITEnvTypeEnum.valueOf(StringUtils.defaultIfBlank(props.getProperty("transaction.it.env.type").toUpperCase(), TransactionITEnvTypeEnum.NONE.name()));
+ mysqlVersions = splitProperty("transaction.it.docker.mysql.version");
+ postgresVersions = splitProperty("transaction.it.docker.postgresql.version");
+ openGaussVersions = splitProperty("transaction.it.docker.opengauss.version");
+ transactionTestCaseRegistryMap = initTransactionTestCaseRegistryMap();
+ }
+
+ private Map<String, TransactionTestCaseRegistry> initTransactionTestCaseRegistryMap() {
+ final Map<String, TransactionTestCaseRegistry> transactionTestCaseRegistryMap;
+ transactionTestCaseRegistryMap = new HashMap<>(TransactionTestCaseRegistry.values().length, 1);
+ for (TransactionTestCaseRegistry each : TransactionTestCaseRegistry.values()) {
+ transactionTestCaseRegistryMap.put(each.getTestCaseClass().getName(), each);
+ }
+ return transactionTestCaseRegistryMap;
+ }
+
+ private List<String> splitProperty(final String key) {
+ return Arrays.stream(props.getOrDefault(key, "").toString().split(",")).filter(StringUtils::isNotBlank).collect(Collectors.toList());
+ }
+
+ private Properties loadProperties() {
+ Properties result = new Properties();
+ try (InputStream inputStream = IntegrationTestEnvironment.class.getClassLoader().getResourceAsStream("env/transaction-it-env.properties")) {
+ result.load(inputStream);
+ } catch (final IOException ex) {
+ throw new RuntimeException(ex);
+ }
+ for (String each : System.getProperties().stringPropertyNames()) {
+ result.setProperty(each, System.getProperty(each));
+ }
+ return result;
+ }
+
+ /**
+ * Get actual data source connection.
+ *
+ * @param databaseType database type.
+ * @return jdbc connection
+ */
+ public JdbcInfoEntity getActualDatabaseJdbcInfo(final DatabaseType databaseType) {
+ String username;
+ String password;
+ int port;
+ switch (databaseType.getType()) {
+ case "MySQL":
+ username = props.getOrDefault("transaction.it.native.mysql.username", "root").toString();
+ password = props.getOrDefault("transaction.it.native.mysql.password", "root").toString();
+ port = Integer.parseInt(props.getOrDefault("transaction.it.native.mysql.port", 3307).toString());
+ break;
+ case "PostgreSQL":
+ username = props.getOrDefault("transaction.it.native.postgresql.username", "postgres").toString();
+ password = props.getOrDefault("transaction.it.native.postgresql.password", "postgres").toString();
+ port = Integer.parseInt(props.getOrDefault("transaction.it.native.postgresql.port", 5432).toString());
+ break;
+ case "openGauss":
+ username = props.getOrDefault("transaction.it.native.opengauss.username", "gaussdb").toString();
+ password = props.getOrDefault("transaction.it.native.opengauss.password", "Root@123").toString();
+ port = Integer.parseInt(props.getOrDefault("transaction.it.native.opengauss.port", 5432).toString());
+ break;
+ default:
+ throw new UnsupportedOperationException("Unsupported database type: " + databaseType.getType());
+ }
+ return new JdbcInfoEntity(username, password, port);
+ }
+
+ /**
+ * Get actual data source default port.
+ *
+ * @param databaseType database type.
+ * @return default port
+ */
+ public int getActualDataSourceDefaultPort(final DatabaseType databaseType) {
+ switch (databaseType.getType()) {
+ case "MySQL":
+ return Integer.parseInt(props.getOrDefault("transaction.it.native.mysql.port", 3306).toString());
+ case "PostgreSQL":
+ return Integer.parseInt(props.getOrDefault("transaction.it.native.postgresql.port", 5432).toString());
+ case "openGauss":
+ return Integer.parseInt(props.getOrDefault("transaction.it.native.opengauss.port", 5432).toString());
+ default:
+ throw new IllegalArgumentException("Unsupported database type: " + databaseType.getType());
+ }
+ }
+
+ /**
+ * Get native database type.
+ *
+ * @return native database type
+ */
+ public String getNativeDatabaseType() {
+ return String.valueOf(props.get("transaction.it.native.database"));
+ }
+
+ /**
+ * Get actual data source username.
+ *
+ * @param databaseType database type.
+ * @return actual data source username
+ */
+ public String getActualDataSourceUsername(final DatabaseType databaseType) {
+ String username;
+ if (databaseType instanceof OpenGaussDatabaseType) {
+ username = "gaussdb";
+ } else {
+ username = "root";
+ }
Review Comment:
You are right,I will revise it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925099395
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/BaseSavePointTestCase.java:
##########
@@ -0,0 +1,71 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Savepoint;
+
+/**
+ * Auto commit transaction integration test.
+ */
Review Comment:
It is a mistake,I will correct it.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/MySQLSavePointTestCase.java:
##########
@@ -0,0 +1,44 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+
+import javax.sql.DataSource;
+
+/**
+ * MySQL auto commit transaction integration test.
+ */
Review Comment:
It is a mistake,I will correct it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r922951271
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/database/OpenGaussContainer.java:
##########
@@ -0,0 +1,81 @@
+/*
+ * 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.integration.transaction.framework.container.database;
+
+import org.apache.commons.lang3.StringUtils;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.database.type.dialect.OpenGaussDatabaseType;
+import org.apache.shardingsphere.integration.transaction.env.IntegrationTestEnvironment;
+import org.apache.shardingsphere.integration.transaction.env.enums.TransactionITEnvTypeEnum;
+import org.apache.shardingsphere.test.integration.env.DataSourceEnvironment;
+import org.apache.shardingsphere.test.integration.framework.container.wait.JDBCConnectionWaitStrategy;
+import org.testcontainers.containers.BindMode;
+
+import java.sql.DriverManager;
+
+/**
+ * OpenGauss container for Scaling IT.
+ */
Review Comment:
I just copied this class, I'll change it later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925100597
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/constants/TransactionTestConstants.java:
##########
@@ -0,0 +1,37 @@
+/*
+ * 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.integration.transaction.engine.constants;
+
+public class TransactionTestConstants {
+
Review Comment:
I will correct it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925101668
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/autocommit/AutoCommitTestCase.java:
##########
@@ -0,0 +1,70 @@
+/*
+ * 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.integration.transaction.cases.autocommit;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.data.pipeline.core.util.ThreadUtil;
+import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.junit.Assert;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase
+public final class AutoCommitTestCase extends BaseTransactionTestCase {
+
+ public AutoCommitTestCase(final DataSource dataSource) {
+ super(dataSource);
+ }
+
+ @Override
+ @SneakyThrows(SQLException.class)
+ public void assertTest() {
+ assertAutoCommit();
+ }
Review Comment:
`executeTest()` is ok?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r922949728
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/pom.xml:
##########
@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ 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.
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-integration-test</artifactId>
+ <version>5.1.3-SNAPSHOT</version>
Review Comment:
You are right.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#issuecomment-1188631574
Test cases ran successfully.
<img width="1271" alt="image" src="https://user-images.githubusercontent.com/19788130/179676088-6c7e2b03-2479-40f5-b3a3-b5fc8d5b2f01.png">
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925109848
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/commitrollback/CommitAndRollbackTestCase.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.integration.transaction.cases.commitrollback;
+
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * Commit and rollback transaction integration test.
+ */
+@TransactionTestCase
+public final class CommitAndRollbackTestCase extends BaseTransactionTestCase {
+
+ public CommitAndRollbackTestCase(final DataSource dataSource) {
Review Comment:
I will change these class names to `MultiTableCommitAndRollbackTestCase` and `SingleTableCommitAndRollbackTestCase`,thank you for your help.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r922951156
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/framework/container/database/DatabaseContainer.java:
##########
@@ -0,0 +1,65 @@
+/*
+ * 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.integration.transaction.framework.container.database;
+
+import lombok.Getter;
+import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.test.integration.framework.container.atomic.DockerITContainer;
+
+/**
+ * Docker storage container.
+ */
+@Getter
+public abstract class DatabaseContainer extends DockerITContainer {
+
+ private final DatabaseType databaseType;
+
+ public DatabaseContainer(final DatabaseType databaseType, final String dockerImageName) {
+ super(databaseType.getType().toLowerCase(), dockerImageName);
+ this.databaseType = databaseType;
+ }
+
+ /**
+ * Get jdbc url.
+ *
+ * @param databaseName database name
+ * @return jdbc url
+ */
+ public abstract String getJdbcUrl(String databaseName);
+
+ /**
+ * Get database username.
+ *
+ * @return database username
+ */
+ public abstract String getUsername();
+
+ /**
+ * Get database password.
+ *
+ * @return database username
+ */
Review Comment:
It is a mistake...
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] jingshanglu merged pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
jingshanglu merged PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r922950561
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/engine/mysql/MySQLJdbcTransactionIT.java:
##########
@@ -0,0 +1,48 @@
+/*
+ * 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.integration.transaction.engine.mysql;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.BaseTransactionITCase;
+import org.apache.shardingsphere.integration.transaction.framework.param.TransactionParameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import java.sql.SQLException;
+import java.util.Collection;
+
+/**
+ * MySQL general transaction test case with JDBC container, includes multiple cases.
+ */
+@Slf4j
+// @RunWith(Parameterized.class)
Review Comment:
Because I haven't added a test method to this class, JUnit will report an error, so I commented out the `@RunWith(Parameterized.class)` annotation now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925099799
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/OpenGaussSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * OpenGauss auto commit transaction integration test.
+ */
Review Comment:
It is a mistake,I will correct it.
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * PostgreSQL auto commit transaction integration test.
+ */
Review Comment:
It is a mistake,I will correct it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925097144
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/commitrollback/CommitAndRollbackTestCase.java:
##########
@@ -0,0 +1,69 @@
+/*
+ * 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.integration.transaction.cases.commitrollback;
+
+import lombok.SneakyThrows;
+import org.apache.shardingsphere.integration.transaction.cases.base.BaseTransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+/**
+ * Commit and rollback transaction integration test.
+ */
+@TransactionTestCase
+public final class CommitAndRollbackTestCase extends BaseTransactionTestCase {
+
+ public CommitAndRollbackTestCase(final DataSource dataSource) {
Review Comment:
`BindingTestCase` is for testing multi-table associated transaction behavior,`CommitAndRollbackTestCase` is for testing single table transaction behavior.Do I need to merge these two classes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] FlyingZC commented on a diff in pull request #19293: Add transaction IT test demo
Posted by GitBox <gi...@apache.org>.
FlyingZC commented on code in PR #19293:
URL: https://github.com/apache/shardingsphere/pull/19293#discussion_r925100271
##########
shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-transaction/src/test/java/org/apache/shardingsphere/integration/transaction/cases/savepoint/PostgreSQLSavePointTestCase.java:
##########
@@ -0,0 +1,72 @@
+/*
+ * 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.integration.transaction.cases.savepoint;
+
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.integration.transaction.engine.base.TransactionTestCase;
+import org.apache.shardingsphere.integration.transaction.engine.constants.TransactionTestConstants;
+import org.junit.Assert;
+import org.opengauss.jdbc.PSQLSavepoint;
+
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.sql.SQLException;
+
+/**
+ * PostgreSQL auto commit transaction integration test.
+ */
+@Slf4j
+@TransactionTestCase(dbTypes = {TransactionTestConstants.POSTGRESQL})
+public class PostgreSQLSavePointTestCase extends BaseSavePointTestCase {
Review Comment:
Your are right.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org