aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/test/java/com/yahoo/compress
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorn.christian@seime.no>2021-01-19 19:19:33 +0100
committerGitHub <noreply@github.com>2021-01-19 19:19:33 +0100
commit3e62c6ae4a6d85699f1af6eeff533aef30493f20 (patch)
treeab57470816ce664a4cd37e5c01f90035131b3c99 /vespajlib/src/test/java/com/yahoo/compress
parent6f326f6cc056dc46f5538a8a186c8420b0379edc (diff)
Revert "Bjorncs/zstd java"
Diffstat (limited to 'vespajlib/src/test/java/com/yahoo/compress')
-rw-r--r--vespajlib/src/test/java/com/yahoo/compress/CompressorTest.java27
-rw-r--r--vespajlib/src/test/java/com/yahoo/compress/ZstdCompressorTest.java37
-rw-r--r--vespajlib/src/test/java/com/yahoo/compress/ZstdOuputStreamTest.java48
3 files changed, 0 insertions, 112 deletions
diff --git a/vespajlib/src/test/java/com/yahoo/compress/CompressorTest.java b/vespajlib/src/test/java/com/yahoo/compress/CompressorTest.java
deleted file mode 100644
index 0c6af48deb8..00000000000
--- a/vespajlib/src/test/java/com/yahoo/compress/CompressorTest.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.compress;
-
-import org.junit.jupiter.api.Test;
-
-import java.util.Optional;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-
-/**
- * @author bjorncs
- */
-class CompressorTest {
-
- @Test
- void compresses_and_decompresses_input_using_zstd() {
- byte[] inputData = "The quick brown fox jumps over the lazy dog".getBytes();
- Compressor compressor = new Compressor(CompressionType.ZSTD);
- Compressor.Compression compression = compressor.compress(CompressionType.ZSTD, inputData, Optional.empty());
- assertEquals(inputData.length, compression.uncompressedSize());
- byte[] compressedData = compression.data();
- byte[] decompressedData = compressor.decompress(CompressionType.ZSTD, compressedData, 0, inputData.length, Optional.of(compressedData.length));
- assertArrayEquals(inputData, decompressedData);
- }
-
-}
diff --git a/vespajlib/src/test/java/com/yahoo/compress/ZstdCompressorTest.java b/vespajlib/src/test/java/com/yahoo/compress/ZstdCompressorTest.java
deleted file mode 100644
index f38ce4ad953..00000000000
--- a/vespajlib/src/test/java/com/yahoo/compress/ZstdCompressorTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.compress;
-
-import org.junit.jupiter.api.Test;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * @author bjorncs
- */
-class ZstdCompressorTest {
-
- @Test
- void compresses_and_decompresses_input() {
- byte[] inputData = "The quick brown fox jumps over the lazy dog".getBytes();
- ZstdCompressor compressor = new ZstdCompressor();
- byte[] compressedData = compressor.compress(inputData, 0, inputData.length);
- byte[] decompressedData = compressor.decompress(compressedData, 0, compressedData.length);
- assertArrayEquals(inputData, decompressedData);
- }
-
- @Test
- void compressed_size_is_less_than_uncompressed() {
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < 100; i++) {
- builder.append("The quick brown fox jumps over the lazy dog").append('\n');
- }
- byte[] inputData = builder.toString().getBytes();
- ZstdCompressor compressor = new ZstdCompressor();
- byte[] compressedData = compressor.compress(inputData, 0, inputData.length);
- assertTrue(
- compressedData.length < inputData.length,
- () -> "Compressed size is " + compressedData.length + " while uncompressed size is " + inputData.length);
- }
-
-}
diff --git a/vespajlib/src/test/java/com/yahoo/compress/ZstdOuputStreamTest.java b/vespajlib/src/test/java/com/yahoo/compress/ZstdOuputStreamTest.java
deleted file mode 100644
index 5d35eb10215..00000000000
--- a/vespajlib/src/test/java/com/yahoo/compress/ZstdOuputStreamTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.compress;
-
-import org.junit.jupiter.api.Test;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-
-import static org.junit.jupiter.api.Assertions.assertArrayEquals;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-
-/**
- * @author bjorncs
- */
-class ZstdOuputStreamTest {
-
- @Test
- void output_stream_compresses_input() throws IOException {
- byte[] inputData = "The quick brown fox jumps over the lazy dog".getBytes();
- ByteArrayOutputStream arrayOut = new ByteArrayOutputStream();
- try (ZstdOuputStream zstdOut = new ZstdOuputStream(arrayOut, 12)) {
- zstdOut.write(inputData[0]);
- zstdOut.write(inputData, 1, inputData.length - 1);
- }
- byte[] compressedData = arrayOut.toByteArray();
- ZstdCompressor compressor = new ZstdCompressor();
- byte[] decompressedData = new byte[inputData.length];
- compressor.decompress(compressedData, 0, compressedData.length, decompressedData, 0, decompressedData.length);
- assertArrayEquals(inputData, decompressedData);
- }
-
- @Test
- void compressed_size_is_less_than_uncompressed() throws IOException {
- StringBuilder builder = new StringBuilder();
- for (int i = 0; i < 100; i++) {
- builder.append("The quick brown fox jumps over the lazy dog").append('\n');
- }
- byte[] inputData = builder.toString().getBytes();
- ByteArrayOutputStream arrayOut = new ByteArrayOutputStream();
- try (ZstdOuputStream zstdOut = new ZstdOuputStream(arrayOut)) {
- zstdOut.write(inputData);
- }
- int compressedSize = arrayOut.toByteArray().length;
- assertTrue(
- compressedSize < inputData.length,
- () -> "Compressed size is " + compressedSize + " while uncompressed size is " + inputData.length);
- }
-}