Skip to content

Commit

Permalink
add changelog & fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
liangzaiwei committed Jan 16, 2025
1 parent b93153b commit 8e20295
Show file tree
Hide file tree
Showing 7 changed files with 105 additions and 14 deletions.
3 changes: 2 additions & 1 deletion changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Add changes here for all PR submitted to the 2.x branch.

- [[#7104](https://github.com/apache/incubator-seata/pull/7104)] fix impl of supportsSourceType is not defined
- [[#7112](https://github.com/apache/incubator-seata/pull/7112)] bugfix: remove the condition that IPv6 must start with fe80
- [[#7107](https://github.com/apache/incubator-seata/pull/7107)] fix the issue of failing to parse annotations in TCC mode when the business object is a proxy object.


### optimize:
Expand Down Expand Up @@ -47,6 +48,6 @@ Thanks to these contributors for their code commits. Please report an unintended
- [funky-eyes](https://github.com/funky-eyes)
- [psxjoy](https://github.com/psxjoy)
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)

- [wxrqforever](https://github.com/wxrqforever)

Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
2 changes: 2 additions & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

- [[#7104](https://github.com/apache/incubator-seata/pull/7104)] 修复SeataApplicationListener在低版本springboot未实现supportsSourceType方法的问题
- [[#7112](https://github.com/apache/incubator-seata/pull/7112)] 校验是否IPv6网络ip取消必须以fe80开始的条件
- [[#7107](https://github.com/apache/incubator-seata/pull/7107)] 修复tcc模式下,当业务对象为代理对象时,解析注解失败问题。

### optimize:

Expand Down Expand Up @@ -46,5 +47,6 @@
- [funky-eyes](https://github.com/funky-eyes)
- [psxjoy](https://github.com/psxjoy)
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)
- [wxrqforever](https://github.com/wxrqforever)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
import java.io.IOException;
import org.apache.seata.integration.tx.api.interceptor.handler.ProxyInvocationHandler;
import org.apache.seata.rm.tcc.interceptor.parser.TccActionInterceptorParser;
import org.apache.seata.spring.tcc.EasyTccAction;
import org.apache.seata.spring.tcc.EasyTccActionImpl;
import org.apache.seata.spring.tcc.NormalTccAction;
import org.apache.seata.spring.tcc.NormalTccActionImpl;
import org.apache.seata.spring.tcc.TccAnnoAtInterAction;
import org.apache.seata.spring.tcc.TccAnnoAtInterActionImpl;
import org.apache.seata.spring.tcc.TccAnnoAtInterImplAction;
import org.apache.seata.spring.tcc.TccAnnoAtInterImplActionImpl;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
Expand All @@ -44,20 +44,20 @@ public static void init() throws IOException {

@Test
void testParserInterfaceToProxyForSpringCGLIB() throws Exception {
//local tcc anno at interface
//local tcc anno at interface impl
{
TccActionInterceptorParser tccActionInterceptorParser = new TccActionInterceptorParser();
EasyTccActionImpl tccAction = new EasyTccActionImpl();
EasyTccAction proxyTccAction = createSpringCGLIBProxy(tccAction, "doSomething", EasyTccAction.class);
TccAnnoAtInterImplActionImpl tccAction = new TccAnnoAtInterImplActionImpl();
TccAnnoAtInterImplAction proxyTccAction = createSpringCGLIBProxy(tccAction, "doSomething", TccAnnoAtInterImplAction.class);
ProxyInvocationHandler proxyInvocationHandler = tccActionInterceptorParser.parserInterfaceToProxy(proxyTccAction, proxyTccAction.getClass().getName());
Assertions.assertNotNull(proxyInvocationHandler);
}

//local tcc anno at interface impl
//local tcc anno at interface
{
TccActionInterceptorParser tccActionInterceptorParser = new TccActionInterceptorParser();
NormalTccActionImpl tccAction = new NormalTccActionImpl();
NormalTccAction proxyTccAction = createSpringCGLIBProxy(tccAction, "doSomething", NormalTccAction.class);
TccAnnoAtInterActionImpl tccAction = new TccAnnoAtInterActionImpl();
TccAnnoAtInterAction proxyTccAction = createSpringCGLIBProxy(tccAction, "doSomething", TccAnnoAtInterAction.class);
ProxyInvocationHandler proxyInvocationHandler = tccActionInterceptorParser.parserInterfaceToProxy(proxyTccAction, proxyTccAction.getClass().getName());
Assertions.assertNotNull(proxyInvocationHandler);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.spring.tcc;

import org.apache.seata.rm.tcc.api.BusinessActionContext;
import org.apache.seata.rm.tcc.api.LocalTCC;
import org.apache.seata.rm.tcc.api.TwoPhaseBusinessAction;

@LocalTCC
public interface TccAnnoAtInterAction {

/**
* Prepare boolean.
*
* @param actionContext the action context
* @return the boolean
*/
@TwoPhaseBusinessAction(name = "TccAnnoAtInterAction", commitMethod = "commit", rollbackMethod = "rollback")
boolean prepare(BusinessActionContext actionContext);

/**
* Commit boolean.
*
* @param actionContext the action context
* @return the boolean
*/
boolean commit(BusinessActionContext actionContext);

/**
* Rollback boolean.
*
* @param actionContext the action context
* @return the boolean
*/
boolean rollback(BusinessActionContext actionContext);

}
Original file line number Diff line number Diff line change
@@ -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.seata.spring.tcc;

import org.apache.seata.rm.tcc.api.BusinessActionContext;

public class TccAnnoAtInterActionImpl implements TccAnnoAtInterAction {

@Override
public boolean prepare(BusinessActionContext actionContext) {
return false;
}

@Override
public boolean commit(BusinessActionContext actionContext) {
return false;
}

@Override
public boolean rollback(BusinessActionContext actionContext) {
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.apache.seata.rm.tcc.api.BusinessActionContext;


public interface EasyTccAction {
public interface TccAnnoAtInterImplAction {

/**
* Prepare boolean.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@


@LocalTCC
public class EasyTccActionImpl implements EasyTccAction {
public class TccAnnoAtInterImplActionImpl implements TccAnnoAtInterImplAction {

@Override
@TwoPhaseBusinessAction(name = "easyActionForTest", commitMethod = "commit", rollbackMethod = "rollback")
@TwoPhaseBusinessAction(name = "TccAnnoAtInterImplAction", commitMethod = "commit", rollbackMethod = "rollback")
public boolean prepare(BusinessActionContext actionContext) {
return false;
}
Expand Down

0 comments on commit 8e20295

Please sign in to comment.