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,47 @@
<?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>
<groupId>io.seata</groupId>
<artifactId>seata-compressor</artifactId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>seata-compressor-7z</artifactId>
<packaging>jar</packaging>
<name>seata-compressor-7z ${project.version}</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>seata-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</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.compressor.sevenz;
import io.seata.common.loader.LoadLevel;
import io.seata.core.compressor.Compressor;
/**
* the SevenZ Compressor
*
* @author ph3636
*/
@LoadLevel(name = "SEVENZ")
public class SevenZCompressor implements Compressor {
@Override
public byte[] compress(byte[] bytes) {
return SevenZUtil.compress(bytes);
}
@Override
public byte[] decompress(byte[] bytes) {
return SevenZUtil.decompress(bytes);
}
}

View File

@@ -0,0 +1,73 @@
/*
* 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.compressor.sevenz;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry;
import org.apache.commons.compress.archivers.sevenz.SevenZFile;
import org.apache.commons.compress.archivers.sevenz.SevenZOutputFile;
import org.apache.commons.compress.utils.SeekableInMemoryByteChannel;
/**
* the SevenZ Util
*
* @author ph3636
*/
public class SevenZUtil {
private static final int BUFFER_SIZE = 8192;
public static byte[] compress(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("bytes is null");
}
SeekableInMemoryByteChannel channel = new SeekableInMemoryByteChannel();
try (SevenZOutputFile z7z = new SevenZOutputFile(channel)) {
SevenZArchiveEntry entry = new SevenZArchiveEntry();
entry.setName("sevenZip");
entry.setSize(bytes.length);
z7z.putArchiveEntry(entry);
z7z.write(bytes);
z7z.closeArchiveEntry();
z7z.finish();
return channel.array();
} catch (IOException e) {
throw new RuntimeException("SevenZ compress error", e);
}
}
public static byte[] decompress(byte[] bytes) {
if (bytes == null) {
throw new NullPointerException("bytes is null");
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
SeekableInMemoryByteChannel channel = new SeekableInMemoryByteChannel(bytes);
try (SevenZFile sevenZFile = new SevenZFile(channel)) {
byte[] buffer = new byte[BUFFER_SIZE];
while (sevenZFile.getNextEntry() != null) {
int n;
while ((n = sevenZFile.read(buffer)) > -1) {
out.write(buffer, 0, n);
}
}
return out.toByteArray();
} catch (IOException e) {
throw new RuntimeException("SevenZ decompress error", e);
}
}
}

View File

@@ -0,0 +1 @@
io.seata.compressor.sevenz.SevenZCompressor

View File

@@ -0,0 +1,36 @@
/*
* 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.compressor.sevenz;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* the SevenZ Compressor test
*
* @author ph3636
*/
public class SevenZCompressorTest {
@Test
public void testCompressAndDecompress() {
SevenZCompressor compressor = new SevenZCompressor();
byte[] bytes = "aa".getBytes();
bytes = compressor.compress(bytes);
bytes = compressor.decompress(bytes);
Assertions.assertEquals(new String(bytes), "aa");
}
}

View File

@@ -0,0 +1,42 @@
/*
* 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.compressor.sevenz;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
/**
* the SevenZ Util test
*
* @author ph3636
*/
public class SevenZUtilTest {
@Test
public void test_compress() {
Assertions.assertThrows(NullPointerException.class, () -> {
SevenZUtil.compress(null);
});
}
@Test
public void test_decompress() {
Assertions.assertThrows(NullPointerException.class, () -> {
SevenZUtil.decompress(null);
});
}
}