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:
#	changes/en-us/2.x.md
#	dependencies/pom.xml
#	pom.xml
#	test/src/test/java/org/apache/seata/common/ConfigurationTestHelper.java
  • Loading branch information
wangliang181230 committed Apr 1, 2024
2 parents 4a2942a + d318409 commit 5ba52d0
Show file tree
Hide file tree
Showing 67 changed files with 1,048 additions and 269 deletions.
21 changes: 15 additions & 6 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6169](https://github.com/apache/incubator-seata/pull/6169)] full support for states in the refactored state machine designer
- [[#6230](https://github.com/apache/incubator-seata/pull/6230)] RocketMQ transaction are supported
- [[#6326](https://github.com/apache/incubator-seata/pull/6326)] support raft node metadata sync
- [[#6415](https://github.com/apache/incubator-seata/pull/6415)] support autolayout in seata-statemachine-designer

### bugfix:
- [[#6090](https://github.com/apache/incubator-seata/pull/6090)] fix the TCC aspect exception handling process, do not wrapping the internal call exceptions
Expand Down Expand Up @@ -104,16 +105,18 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6360](https://github.com/apache/incubator-seata/pull/6360)] optimize 401 issues for some links
- [[#6366](https://github.com/apache/incubator-seata/pull/6366)] optimized globaltransaction compatibility issues
- [[#6369](https://github.com/apache/incubator-seata/pull/6369)] optimize arm64 ci
- [[#6386](https://github.com/apache/incubator-seata/pull/6386)] replace `byte-buddy` to JDK proxy in `ConfigurationCache`
- [[#6386](https://github.com/apache/incubator-seata/pull/6386)] replace `byte-buddy` to JDK proxy
in `ConfigurationCache`
- [[#6398](https://github.com/apache/incubator-seata/pull/6398)] Splitting dependencies for common, client, and server, and simplify pom
- [[#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
- [[#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

- [[#6419](https://github.com/apache/incubator-seata/pull/6419)] optimize integration-tx-api compatible
- [[#6405](https://github.com/apache/incubator-seata/pull/6405)] fix kotlin compile failure
- [[#6412](https://github.com/apache/incubator-seata/pull/6412)] optimize core compatible module
- [[#6429](https://github.com/apache/incubator-seata/pull/6429)] remove repetitive words

### security:
- [[#6069](https://github.com/apache/incubator-seata/pull/6069)] Upgrade Guava dependencies to fix security vulnerabilities
Expand All @@ -133,9 +136,13 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6157](https://github.com/apache/incubator-seata/pull/6157)] increase common module unit test coverage
- [[#6250](https://github.com/apache/incubator-seata/pull/6250)] increase seata-core module unit test coverage
- [[#6325](https://github.com/apache/incubator-seata/pull/6325)] fix mockServerTest fail cause using same port with seata-server
- [[#6430](https://github.com/apache/incubator-seata/pull/6430)] increase common module unit test coverage

### refactor:

- [[#6280](https://github.com/apache/incubator-seata/pull/6280)] refactor Saga designer using diagram-js
- [[#6269](https://github.com/apache/incubator-seata/pull/6269)] standardize Seata Exception
- [[#6420](https://github.com/apache/incubator-seata/pull/6420)] refactor Configuration Cache

Thanks to these contributors for their code commits. Please report an unintended omission.

Expand Down Expand Up @@ -164,5 +171,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [saberyjs](https://github.com/SABERYJS)
- [gggyd123](https://github.com/gggyd123)
- [jonasHanhan](https://github.com/jonasHanhan)
- [Code-breaker1998](https://github.com/Code-breaker1998)
- [MikhailNavitski](https://github.com/MikhailNavitski)

Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
15 changes: 11 additions & 4 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [[#6169](https://github.com/apache/incubator-seata/pull/6169)] 支持新版本状态机设计器
- [[#6230](https://github.com/apache/incubator-seata/pull/6230)] 支持RocketMQ消息事务
- [[#6326](https://github.com/apache/incubator-seata/pull/6326)] 支持raft节点间的元数据同步
- [[#6415](https://github.com/apache/incubator-seata/pull/6415)] 支持 Saga 设计器的自动布局

### bugfix:
- [[#6090](https://github.com/apache/incubator-seata/pull/6090)] 修复tcc切面异常处理过程,不对内部调用异常做包装处理,直接向外抛出
Expand Down Expand Up @@ -114,10 +115,10 @@
- [[#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:
- [[#6269](https://github.com/apache/incubator-seata/pull/6269)] 统一Seata异常规范
- [[#6419](https://github.com/apache/incubator-seata/pull/6419)] 优化integration-tx-api向下兼容
- [[#6405](https://github.com/apache/incubator-seata/pull/6405)] 修复 kotlin 编译失败
- [[#6412](https://github.com/apache/incubator-seata/pull/6412)] 优化 core 兼容模块
- [[#6429](https://github.com/apache/incubator-seata/pull/6429)] 移除重复注释

### security:
- [[#6069](https://github.com/apache/incubator-seata/pull/6069)] 升级Guava依赖版本,修复安全漏洞
Expand All @@ -135,9 +136,13 @@
- [[#6157](https://github.com/apache/incubator-seata/pull/6157)] 增加common模块单测覆盖率
- [[#6250](https://github.com/apache/incubator-seata/pull/6250)] 增加seata-core模块单测覆盖率
- [[#6325](https://github.com/apache/incubator-seata/pull/6325)] 修复mock-server相关测试用例
- [[#6430](https://github.com/apache/incubator-seata/pull/6430)] 增加 common 模块单元测试覆盖率

### refactor:

- [[#6280](https://github.com/apache/incubator-seata/pull/6280)] 使用diagram-js重构Saga设计器
- [[#6269](https://github.com/apache/incubator-seata/pull/6269)] 统一Seata异常规范
- [[#6420](https://github.com/apache/incubator-seata/pull/6420)] 优化配置缓存

非常感谢以下 contributors 的代码贡献。若有无意遗漏,请报告。

Expand Down Expand Up @@ -166,5 +171,7 @@
- [saberyjs](https://github.com/SABERYJS)
- [gggyd123](https://github.com/gggyd123)
- [jonasHanhan](https://github.com/jonasHanhan)
- [Code-breaker1998](https://github.com/Code-breaker1998)
- [MikhailNavitski](https://github.com/MikhailNavitski)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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.seata.common.exception;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertAll;
import static org.junit.jupiter.api.Assertions.assertThrowsExactly;


class RepeatRegistrationExceptionTest {

@Test
void testRepeatRegistrationException() {
assertAll(
() -> assertThrowsExactly(RepeatRegistrationException.class, () -> {
throw new RepeatRegistrationException("error");
}),
() -> assertThrowsExactly(RepeatRegistrationException.class, () -> {
throw new RepeatRegistrationException("error", new Throwable("error"));
}),
() -> assertThrowsExactly(RepeatRegistrationException.class, () -> {
throw new RepeatRegistrationException(new Throwable("error"));
})
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* 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.seata.common.exception;

import org.junit.jupiter.api.Test;

import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrowsExactly;

class SkipCallbackWrapperExceptionTest {

@Test
void testSkipCallbackWrapperException() {
assertThrowsExactly(SkipCallbackWrapperException.class, () -> {
throw new SkipCallbackWrapperException(new Throwable("error"));
});

}

@Test
void testFillInStackTrace() {
SkipCallbackWrapperException skipCallbackWrapperException = new SkipCallbackWrapperException(new Throwable("error"));
assertNull(skipCallbackWrapperException.fillInStackTrace());

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.seata.common.util;

import org.junit.jupiter.api.Test;

import java.util.function.Function;
import java.util.function.Predicate;

import static org.junit.jupiter.api.Assertions.assertTrue;

class LambdaUtilsTest {

@Test
void shouldReturnTrueForDistinctKeys() {
Function<Object, Object> keyExtractor = Object::getClass;
Predicate<Object> distinctByKey = LambdaUtils.distinctByKey(keyExtractor);

boolean result = distinctByKey.test(new Object());
assertTrue(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

/**
* The type AuthSigner
* Notes: used for io.seata SPI interface
*/
public interface AuthSigner extends org.apache.seata.core.auth.AuthSigner {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

/**
* The type Compressor
*
* Notes: used for io.seata SPI interface
*/
public interface Compressor extends org.apache.seata.core.compressor.Compressor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@


/**
*
*
* The interface Context core.
*
* Notes: used for io.seata SPI interface
*/
public interface ContextCore extends org.apache.seata.core.context.ContextCore {
}
13 changes: 5 additions & 8 deletions compatible/src/main/java/io/seata/core/context/RootContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,18 @@
*/
package io.seata.core.context;

import io.seata.core.model.BranchType;
import java.util.Map;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Map;

import io.seata.core.model.BranchType;

/**
* The type Root context.
*/
public class RootContext {

private static org.apache.seata.core.model.BranchType convertApacheSeata(BranchType branchType) {
return org.apache.seata.core.model.BranchType.get(branchType.name());
}

private static BranchType convertIoSeata(org.apache.seata.core.model.BranchType branchType) {
return BranchType.get(branchType.name());
}
Expand All @@ -41,7 +38,7 @@ private static BranchType convertIoSeata(org.apache.seata.core.model.BranchType
* @param defaultBranchType the default branch type
*/
public static void setDefaultBranchType(BranchType defaultBranchType) {
org.apache.seata.core.context.RootContext.setDefaultBranchType(convertApacheSeata(defaultBranchType));
org.apache.seata.core.context.RootContext.setDefaultBranchType(defaultBranchType.convertBranchType());
}

/**
Expand Down Expand Up @@ -148,7 +145,7 @@ public static BranchType getBranchType() {
* @param branchType the branch type
*/
public static void bindBranchType(@Nonnull BranchType branchType) {
org.apache.seata.core.context.RootContext.bindBranchType(convertApacheSeata(branchType));
org.apache.seata.core.context.RootContext.bindBranchType(branchType.convertBranchType());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,25 @@
*/
package io.seata.core.exception;


/**
* The type Transaction exception.
*/
public class TransactionException extends org.apache.seata.core.exception.TransactionException {

private static org.apache.seata.core.exception.TransactionExceptionCode convertApacheSeataTransactionExceptionCode(TransactionExceptionCode transactionExceptionCode) {
return org.apache.seata.core.exception.TransactionExceptionCode.get(transactionExceptionCode.ordinal());
}

public TransactionException(TransactionExceptionCode code) {
super(convertApacheSeataTransactionExceptionCode(code));
super(code.convertTransactionExceptionCode());
}

public TransactionException(TransactionExceptionCode code, Throwable cause) {
super(convertApacheSeataTransactionExceptionCode(code), cause);
super(code.convertTransactionExceptionCode(), cause);
}

public TransactionException(String message) {
super(message);
}

public TransactionException(TransactionExceptionCode code, String message) {
super(convertApacheSeataTransactionExceptionCode(code), message);
super(code.convertTransactionExceptionCode(), message);
}

public TransactionException(Throwable cause) {
Expand All @@ -51,6 +46,6 @@ public TransactionException(String message, Throwable cause) {
}

public TransactionException(TransactionExceptionCode code, String message, Throwable cause) {
super(convertApacheSeataTransactionExceptionCode(code), message, cause);
super(code.convertTransactionExceptionCode(), message, cause);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,8 @@ public static TransactionExceptionCode get(int ordinal) {
return value;
}

public org.apache.seata.core.exception.TransactionExceptionCode convertTransactionExceptionCode() {
return org.apache.seata.core.exception.TransactionExceptionCode.get(this.ordinal());
}

}
4 changes: 4 additions & 0 deletions compatible/src/main/java/io/seata/core/model/BranchType.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,8 @@ public static BranchType get(String name) {
}
throw new IllegalArgumentException("Unknown BranchType[" + name + "]");
}

public org.apache.seata.core.model.BranchType convertBranchType() {
return org.apache.seata.core.model.BranchType.get(this.name());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,8 @@ public static boolean isTwoPhaseHeuristic(GlobalStatus status) {
}
return false;
}

public org.apache.seata.core.model.GlobalStatus convertGlobalStatus() {
return org.apache.seata.core.model.GlobalStatus.get(this.getCode());
}
}

0 comments on commit 5ba52d0

Please sign in to comment.