Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/2.x' into test-dependency-stru…
Browse files Browse the repository at this point in the history
…cture

# Conflicts:
#	compatible/pom.xml
  • Loading branch information
wangliang181230 committed Mar 12, 2024
2 parents d5b67d1 + f93a721 commit f0aa62d
Show file tree
Hide file tree
Showing 31 changed files with 2,592 additions and 242 deletions.
1 change: 1 addition & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6391](https://github.com/apache/incubator-seata/pull/6091)] forbid duplicate registration of TCC resources
- [[#6393](https://github.com/apache/incubator-seata/pull/6393)] determine the version before sync metadata and add retry mechanism
- [[#6387](https://github.com/apache/incubator-seata/pull/6387)] optimize tcc use compatible
- [[#6402](https://github.com/apache/incubator-seata/pull/6402)] optimize rm-datasource use compatible

### refactor:
- [[#6269](https://github.com/apache/incubator-seata/pull/6269)] standardize Seata Exception
Expand Down
1 change: 1 addition & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
- [[#6391](https://github.com/apache/incubator-seata/pull/6091)] 禁止重复注册TCC资源
- [[#6393](https://github.com/apache/incubator-seata/pull/6393)] 元数据同步前判断版本,并增加重试功能
- [[#6387](https://github.com/apache/incubator-seata/pull/6387)] 优化tcc使用兼容
- [[#6402](https://github.com/apache/incubator-seata/pull/6402)] 优化rm-datasource向下兼容


### refactor:
Expand Down
46 changes: 44 additions & 2 deletions compatible/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<mockito.version>4.11.0</mockito.version>
<druid.version>1.2.7</druid.version>
<mysql.version>5.1.42</mysql.version>
<mariadb.version>2.7.2</mariadb.version>
<assertj-core.version>3.12.2</assertj-core.version>
</properties>
<dependencies>
<dependency>
Expand All @@ -57,12 +63,12 @@
</dependency>
<dependency>
<groupId>org.apache.seata</groupId>
<artifactId>seata-metrics-api</artifactId>
<artifactId>seata-sqlparser-druid</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.seata</groupId>
<artifactId>seata-sqlparser-druid</artifactId>
<artifactId>seata-metrics-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down Expand Up @@ -125,7 +131,43 @@
<artifactId>seata-tcc</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<scope>provided</scope>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-inline</artifactId>
<version>${mockito.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>${mariadb.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,87 @@
*/
package io.seata.rm.datasource;

import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
import javax.sql.DataSource;
import org.apache.seata.core.model.BranchType;
import org.apache.seata.rm.datasource.SeataDataSourceProxy;

/**
* The type Data source proxy.
*
*/
public class DataSourceProxy extends org.apache.seata.rm.datasource.DataSourceProxy {
public class DataSourceProxy implements SeataDataSourceProxy {
private final org.apache.seata.rm.datasource.DataSourceProxy dataSourceProxy;

public DataSourceProxy(DataSource targetDataSource) {
super(targetDataSource);
this.dataSourceProxy = new org.apache.seata.rm.datasource.DataSourceProxy(targetDataSource);
}

public DataSourceProxy(DataSource targetDataSource, String resourceGroupId) {
super(targetDataSource, resourceGroupId);
this.dataSourceProxy = new org.apache.seata.rm.datasource.DataSourceProxy(targetDataSource, resourceGroupId);
}

@Override
public DataSource getTargetDataSource() {
return dataSourceProxy.getTargetDataSource();
}

@Override
public BranchType getBranchType() {
return dataSourceProxy.getBranchType();
}

@Override
public Connection getConnection() throws SQLException {
return dataSourceProxy.getConnection();
}

@Override
public Connection getConnection(String username, String password) throws SQLException {
return dataSourceProxy.getConnection(username, password);
}

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return dataSourceProxy.unwrap(iface);
}

@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return dataSourceProxy.isWrapperFor(iface);
}

@Override
public PrintWriter getLogWriter() throws SQLException {
return dataSourceProxy.getLogWriter();
}

@Override
public void setLogWriter(PrintWriter out) throws SQLException {
dataSourceProxy.setLogWriter(out);
}

@Override
public void setLoginTimeout(int seconds) throws SQLException {
dataSourceProxy.setLoginTimeout(seconds);
}

@Override
public int getLoginTimeout() throws SQLException {
return dataSourceProxy.getLoginTimeout();
}

@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return dataSourceProxy.getParentLogger();
}

public String getResourceId() {
return dataSourceProxy.getResourceId();
}

}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,83 @@
*/
package io.seata.rm.datasource.xa;

import java.io.PrintWriter;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.logging.Logger;
import javax.sql.DataSource;
import org.apache.seata.core.model.BranchType;
import org.apache.seata.rm.datasource.SeataDataSourceProxy;

/**
* DataSource proxy for XA mode.
*
*/
public class DataSourceProxyXA extends org.apache.seata.rm.datasource.xa.DataSourceProxyXA {
public class DataSourceProxyXA implements SeataDataSourceProxy {

private final org.apache.seata.rm.datasource.xa.DataSourceProxyXA dataSourceProxyXA;

public DataSourceProxyXA(DataSource dataSource) {
super(dataSource);
this.dataSourceProxyXA = new org.apache.seata.rm.datasource.xa.DataSourceProxyXA(dataSource);
}

public DataSourceProxyXA(DataSource dataSource, String resourceGroupId) {
super(dataSource, resourceGroupId);
this.dataSourceProxyXA = new org.apache.seata.rm.datasource.xa.DataSourceProxyXA(dataSource, resourceGroupId);
}

@Override
public DataSource getTargetDataSource() {
return dataSourceProxyXA.getTargetDataSource();
}

@Override
public BranchType getBranchType() {
return dataSourceProxyXA.getBranchType();
}

@Override
public Connection getConnection() throws SQLException {
return dataSourceProxyXA.getConnection();
}

@Override
public Connection getConnection(String username, String password) throws SQLException {
return dataSourceProxyXA.getConnection(username, password);
}

@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return dataSourceProxyXA.unwrap(iface);
}

@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return dataSourceProxyXA.isWrapperFor(iface);
}

@Override
public PrintWriter getLogWriter() throws SQLException {
return dataSourceProxyXA.getLogWriter();
}

@Override
public void setLogWriter(PrintWriter out) throws SQLException {
dataSourceProxyXA.setLogWriter(out);
}

@Override
public void setLoginTimeout(int seconds) throws SQLException {
dataSourceProxyXA.setLoginTimeout(seconds);
}

@Override
public int getLoginTimeout() throws SQLException {
return dataSourceProxyXA.getLoginTimeout();
}

@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
return dataSourceProxyXA.getParentLogger();
}
}
25 changes: 0 additions & 25 deletions compatible/src/main/java/io/seata/sqlparser/EscapeHandler.java

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit f0aa62d

Please sign in to comment.