chore(project): 添加项目配置文件和忽略规则

- 添加 Babel 配置文件支持 ES6+ 语法转换
- 添加 ESLint 忽略规则和配置文件
- 添加 Git 忽略规则文件
- 添加 Travis CI 配置文件
- 添加 1.4.2 版本变更日志文件
- 添加 Helm 图表辅助模板文件
- 添加 Helm 忽略规则文件
This commit is contained in:
2026-03-27 17:36:48 +08:00
commit c2453d6434
1703 changed files with 277582 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<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">
<parent>
<artifactId>seata-serializer</artifactId>
<groupId>io.seata</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>seata-serializer-fst</artifactId>
<packaging>jar</packaging>
<name>seata-serializer-fst ${project.version}</name>
<dependencies>
<dependency>
<groupId>de.ruedigermoeller</groupId>
<artifactId>fst</artifactId>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,39 @@
/*
* 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.
*/
package io.seata.serializer.fst;
import io.seata.common.loader.LoadLevel;
import io.seata.core.serializer.Serializer;
/**
* @author funkye
*/
@LoadLevel(name = "FST")
public class FstSerializer implements Serializer {
private FstSerializerFactory fstFactory = FstSerializerFactory.getDefaultFactory();
@Override
public <T> byte[] serialize(T t) {
return fstFactory.serialize(t);
}
@Override
public <T> T deserialize(byte[] bytes) {
return (T)fstFactory.deserialize(bytes);
}
}

View File

@@ -0,0 +1,47 @@
/*
* 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.
*/
package io.seata.serializer.fst;
import io.seata.core.serializer.SerializerClassRegistry;
import org.nustaq.serialization.FSTConfiguration;
/**
* @author funkye
*/
public class FstSerializerFactory {
private static final FstSerializerFactory FACTORY = new FstSerializerFactory();
private final FSTConfiguration conf = FSTConfiguration.createDefaultConfiguration();
public static FstSerializerFactory getDefaultFactory() {
return FACTORY;
}
public FstSerializerFactory() {
SerializerClassRegistry.getRegisteredClasses().keySet().forEach(conf::registerClass);
}
public <T> byte[] serialize(T t) {
return conf.asByteArray(t);
}
public <T> T deserialize(byte[] bytes) {
return (T)conf.asObject(bytes);
}
}

View File

@@ -0,0 +1 @@
io.seata.serializer.fst.FstSerializer

View File

@@ -0,0 +1,85 @@
/*
* 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.
*/
package io.seata.serializer.fst;
import io.seata.core.exception.TransactionExceptionCode;
import io.seata.core.model.BranchStatus;
import io.seata.core.model.BranchType;
import io.seata.core.protocol.ResultCode;
import io.seata.core.protocol.transaction.BranchCommitRequest;
import io.seata.core.protocol.transaction.BranchCommitResponse;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
/**
* @author funkye
*/
public class FstSerializerTest {
private static FstSerializer fstSerializer;
@BeforeAll
public static void before() {
fstSerializer = new FstSerializer();
}
@Test
public void testBranchCommitRequest() {
BranchCommitRequest branchCommitRequest = new BranchCommitRequest();
branchCommitRequest.setBranchType(BranchType.AT);
branchCommitRequest.setXid("xid");
branchCommitRequest.setResourceId("resourceId");
branchCommitRequest.setBranchId(20190809);
branchCommitRequest.setApplicationData("app");
byte[] bytes = fstSerializer.serialize(branchCommitRequest);
BranchCommitRequest t = fstSerializer.deserialize(bytes);
assertThat(t.getTypeCode()).isEqualTo(branchCommitRequest.getTypeCode());
assertThat(t.getBranchType()).isEqualTo(branchCommitRequest.getBranchType());
assertThat(t.getXid()).isEqualTo(branchCommitRequest.getXid());
assertThat(t.getResourceId()).isEqualTo(branchCommitRequest.getResourceId());
assertThat(t.getBranchId()).isEqualTo(branchCommitRequest.getBranchId());
assertThat(t.getApplicationData()).isEqualTo(branchCommitRequest.getApplicationData());
}
@Test
public void testBranchCommitResponse() {
BranchCommitResponse branchCommitResponse = new BranchCommitResponse();
branchCommitResponse.setTransactionExceptionCode(TransactionExceptionCode.BranchTransactionNotExist);
branchCommitResponse.setBranchId(20190809);
branchCommitResponse.setBranchStatus(BranchStatus.PhaseOne_Done);
branchCommitResponse.setMsg("20190809");
branchCommitResponse.setXid("20190809");
branchCommitResponse.setResultCode(ResultCode.Failed);
byte[] bytes = fstSerializer.serialize(branchCommitResponse);
BranchCommitResponse t = fstSerializer.deserialize(bytes);
assertThat(t.getTransactionExceptionCode()).isEqualTo(branchCommitResponse.getTransactionExceptionCode());
assertThat(t.getBranchId()).isEqualTo(branchCommitResponse.getBranchId());
assertThat(t.getBranchStatus()).isEqualTo(branchCommitResponse.getBranchStatus());
assertThat(t.getMsg()).isEqualTo(branchCommitResponse.getMsg());
assertThat(t.getResultCode()).isEqualTo(branchCommitResponse.getResultCode());
}
}