Use singular plurals, clean up some stuff.
This commit is contained in:
@@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
import java.util.zip.DataFormatException;
|
||||
import java.util.zip.Deflater;
|
||||
|
||||
public class NativeVelocityCompressor implements VelocityCompressor {
|
||||
private final NativeZlibInflate inflate = new NativeZlibInflate();
|
||||
@@ -14,7 +15,7 @@ public class NativeVelocityCompressor implements VelocityCompressor {
|
||||
|
||||
public NativeVelocityCompressor() {
|
||||
this.inflateCtx = inflate.init();
|
||||
this.deflateCtx = deflate.init(7);
|
||||
this.deflateCtx = deflate.init(Deflater.DEFAULT_COMPRESSION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -9,6 +9,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledOnOs;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.zip.DataFormatException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
@@ -29,19 +30,19 @@ class VelocityCompressorTest {
|
||||
if (compressor instanceof JavaVelocityCompressor) {
|
||||
fail("Loaded regular compressor");
|
||||
}
|
||||
check(compressor);
|
||||
check(compressor, Unpooled::directBuffer);
|
||||
}
|
||||
|
||||
@Test
|
||||
void javaIntegrityCheck() throws DataFormatException {
|
||||
JavaVelocityCompressor compressor = new JavaVelocityCompressor();
|
||||
check(compressor);
|
||||
check(compressor, Unpooled::buffer);
|
||||
}
|
||||
|
||||
private void check(VelocityCompressor compressor) throws DataFormatException {
|
||||
ByteBuf source = Unpooled.directBuffer();
|
||||
ByteBuf dest = Unpooled.directBuffer();
|
||||
ByteBuf decompressed = Unpooled.directBuffer();
|
||||
private void check(VelocityCompressor compressor, Supplier<ByteBuf> supplier) throws DataFormatException {
|
||||
ByteBuf source = supplier.get();
|
||||
ByteBuf dest = supplier.get();
|
||||
ByteBuf decompressed = supplier.get();
|
||||
|
||||
Random random = new Random(1);
|
||||
byte[] randomBytes = new byte[1 << 16];
|
||||
|
Reference in New Issue
Block a user