Skip to content
Snippets Groups Projects
Unverified Commit de56e170 authored by jimin's avatar jimin Committed by GitHub
Browse files

optimize: optimize github action (#3385)

parent 60757168
No related branches found
No related tags found
No related merge requests found
Showing
with 119 additions and 9 deletions
......@@ -2,18 +2,19 @@ name: build
on:
push:
branches: [ develop ]
branches: [ develop,master ]
pull_request:
branches: [ develop ]
branches: [ develop,master ]
jobs:
build:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 1
matrix:
java: [8, 11]
os: [ ubuntu-18.04 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
......@@ -33,9 +34,9 @@ jobs:
REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
# https://docs.github.com/cn/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context
run: if [ "${{github.event_name}}" == "push" ] && [ "${{github.ref}}" == "refs/heads/develop" ]; then
mvn clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -P image -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
mvn clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -P image -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
else
./mvnw clean install -DskipTests=false -Dcheckstyle.skip=false -Dlicense.skip=false -B -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn;
fi
- name: Codecov
uses: codecov/codecov-action@v1
\ No newline at end of file
......@@ -39,11 +39,18 @@ import com.alibaba.druid.mock.MockSQLXML;
import com.alibaba.druid.pool.DruidDataSource;
import com.google.common.collect.Lists;
import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.rm.datasource.mock.MockBlob;
import io.seata.rm.datasource.mock.MockClob;
import io.seata.rm.datasource.mock.MockConnection;
import io.seata.rm.datasource.mock.MockDriver;
import io.seata.sqlparser.SQLRecognizerFactory;
import io.seata.sqlparser.SqlParserType;
import io.seata.sqlparser.druid.DruidDelegatingSQLRecognizerFactory;
import io.seata.sqlparser.druid.SQLOperateRecognizerHolder;
import io.seata.sqlparser.druid.SQLOperateRecognizerHolderFactory;
import io.seata.sqlparser.struct.Null;
import io.seata.sqlparser.util.JdbcConstants;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
......@@ -84,13 +91,17 @@ public class PreparedStatementProxyTest {
ConnectionProxy connectionProxy = new ConnectionProxy(dataSourceProxy, dataSource.getConnection().getConnection());
String sql = "update from prepared_statement_proxy set name = ?";
String sql = "update prepared_statement_proxy set name = ?";
PreparedStatement preparedStatement = mockDriver.createSeataMockPreparedStatement(
(MockConnection)connectionProxy.getTargetConnection(), sql);
preparedStatementProxy = new PreparedStatementProxy(connectionProxy, preparedStatement, sql);
unusedConstructorPreparedStatementProxy = new TestUnusedConstructorPreparedStatementProxy(connectionProxy, preparedStatement);
EnhancedServiceLoader.load(SQLOperateRecognizerHolder.class, JdbcConstants.MYSQL,
SQLOperateRecognizerHolderFactory.class.getClassLoader());
DruidDelegatingSQLRecognizerFactory recognizerFactory = (DruidDelegatingSQLRecognizerFactory) EnhancedServiceLoader
.load(SQLRecognizerFactory.class, SqlParserType.SQL_PARSER_TYPE_DRUID);
}
@Test
......
......@@ -25,16 +25,27 @@ import com.alibaba.druid.mock.MockResultSet;
import com.alibaba.druid.mock.MockStatement;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.util.jdbc.ResultSetMetaDataBase;
import com.google.common.collect.Lists;
import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.rm.datasource.mock.MockConnection;
import io.seata.rm.datasource.mock.MockDriver;
import io.seata.sqlparser.SQLRecognizerFactory;
import io.seata.sqlparser.SqlParserType;
import io.seata.sqlparser.druid.DruidDelegatingSQLRecognizerFactory;
import io.seata.sqlparser.druid.SQLOperateRecognizerHolder;
import io.seata.sqlparser.druid.SQLOperateRecognizerHolderFactory;
import io.seata.sqlparser.util.JdbcConstants;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
/**
* @author will
*/
@TestMethodOrder(MethodOrderer.Alphanumeric.class)
public class StatementProxyTest {
private static List<String> returnValueColumnLabels = Lists.newArrayList("id", "name");
......@@ -76,6 +87,10 @@ public class StatementProxyTest {
((MockStatement) statement).setGeneratedKeys(mockResultSet);
statementProxy = new StatementProxy(connectionProxy, statement);
EnhancedServiceLoader.load(SQLOperateRecognizerHolder.class, JdbcConstants.MYSQL,
SQLOperateRecognizerHolderFactory.class.getClassLoader());
DruidDelegatingSQLRecognizerFactory recognizerFactory = (DruidDelegatingSQLRecognizerFactory) EnhancedServiceLoader
.load(SQLRecognizerFactory.class, SqlParserType.SQL_PARSER_TYPE_DRUID);
}
@Test
......
......@@ -50,6 +50,7 @@ public class SelectForUpdateExecutorTest {
@BeforeAll
public static void init() {
RootContext.unbind();
List<String> returnValueColumnLabels = Lists.newArrayList("id", "name");
Object[][] returnValue = new Object[][] {
new Object[] {1, "Tom"},
......
......@@ -26,9 +26,10 @@ import java.util.Date;
import java.util.List;
import com.alibaba.druid.pool.DruidDataSource;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import io.seata.core.compressor.CompressorType;
import io.seata.common.loader.EnhancedServiceLoader;
import io.seata.rm.datasource.ConnectionContext;
import io.seata.rm.datasource.ConnectionProxy;
import io.seata.rm.datasource.DataSourceProxy;
......@@ -42,8 +43,15 @@ import io.seata.rm.datasource.undo.SQLUndoLog;
import io.seata.rm.datasource.undo.UndoLogParser;
import io.seata.rm.datasource.undo.UndoLogParserFactory;
import io.seata.rm.datasource.undo.parser.JacksonUndoLogParser;
import io.seata.sqlparser.SQLRecognizerFactory;
import io.seata.sqlparser.SQLType;
import io.seata.sqlparser.SqlParserType;
import io.seata.sqlparser.druid.DruidDelegatingSQLRecognizerFactory;
import io.seata.sqlparser.druid.SQLOperateRecognizerHolder;
import io.seata.sqlparser.druid.SQLOperateRecognizerHolderFactory;
import io.seata.sqlparser.util.JdbcConstants;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
......@@ -75,6 +83,14 @@ public class MySQLUndoLogManagerTest {
private TableMeta tableMeta;
@BeforeAll
public static void setup(){
EnhancedServiceLoader.load(SQLOperateRecognizerHolder.class, JdbcConstants.MYSQL,
SQLOperateRecognizerHolderFactory.class.getClassLoader());
DruidDelegatingSQLRecognizerFactory recognizerFactory = (DruidDelegatingSQLRecognizerFactory) EnhancedServiceLoader
.load(SQLRecognizerFactory.class, SqlParserType.SQL_PARSER_TYPE_DRUID);
}
@BeforeEach
public void init() throws SQLException {
MockDriver mockDriver = new MockDriver(returnValueColumnLabels, returnValue, columnMetas, indexMetas);
......
......@@ -15,6 +15,7 @@
*/
package io.seata.rm.xa;
import io.seata.core.context.RootContext;
import io.seata.core.model.BranchType;
import io.seata.core.model.Resource;
import io.seata.core.model.ResourceManager;
......@@ -22,6 +23,7 @@ import io.seata.rm.BaseDataSourceResource;
import io.seata.rm.DefaultResourceManager;
import io.seata.rm.datasource.xa.ConnectionProxyXA;
import io.seata.rm.datasource.xa.StatementProxyXA;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
......@@ -203,4 +205,9 @@ public class ConnectionProxyXATest {
Statement statement = connectionProxyXA.createStatement();
Assertions.assertTrue(statement instanceof StatementProxyXA);
}
@AfterAll
public static void tearDown(){
RootContext.unbind();
}
}
......@@ -22,6 +22,7 @@ import io.seata.core.context.RootContext;
import io.seata.rm.datasource.mock.MockDataSource;
import io.seata.rm.datasource.xa.ConnectionProxyXA;
import io.seata.rm.datasource.xa.DataSourceProxyXA;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
......@@ -86,4 +87,9 @@ public class DataSourceProxyXATest {
Connection connectionInXA = xaConnection.getConnection();
Assertions.assertTrue(connectionInXA instanceof JDBC4ConnectionWrapper);
}
@AfterAll
public static void tearDown(){
RootContext.unbind();
}
}
#
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
#
io.seata.sqlparser.druid.DruidDelegatingSQLRecognizerFactory
#
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
#
io.seata.sqlparser.druid.mysql.MySQLOperateRecognizerHolder
io.seata.sqlparser.druid.oracle.OracleOperateRecognizerHolder
io.seata.sqlparser.druid.postgresql.PostgresqlOperateRecognizerHolder
\ No newline at end of file
#
# Copyright 1999-2019 Seata.io Group.
#
# Licensed 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.
#
io.seata.sqlparser.druid.DruidDelegatingDbTypeParser
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment