Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.io.compress;

import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
Expand Down Expand Up @@ -94,8 +94,9 @@ protected void codecTest(final CompressionCodec codec, final byte[][] input,
LOG.info("{} compressed {} bytes to {} bytes in {} ms", codec.getClass().getSimpleName(), inLen,
compressed.length, end - start);
if (expectedCompressedSize != null) {
assertTrue("Expected compressed size does not match: (expected=" + expectedCompressedSize
+ ", actual=" + compressed.length + ")", expectedCompressedSize == compressed.length);
assertTrue(expectedCompressedSize == compressed.length,
"Expected compressed size does not match: (expected=" + expectedCompressedSize + ", actual="
+ compressed.length + ")");
}
// Decompress
final byte[] plain = new byte[inLen];
Expand All @@ -111,8 +112,8 @@ protected void codecTest(final CompressionCodec codec, final byte[][] input,
// Decompressed bytes should equal the original
int offset = 0;
for (int i = 0; i < input.length; i++) {
assertTrue("Comparison failed at offset " + offset,
Bytes.compareTo(plain, offset, input[i].length, input[i], 0, input[i].length) == 0);
assertTrue(Bytes.compareTo(plain, offset, input[i].length, input[i], 0, input[i].length) == 0,
"Comparison failed at offset " + offset);
offset += input[i].length;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,22 @@

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.compress.HFileTestBase;
import org.apache.hadoop.hbase.testclassification.IOTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category({ IOTests.class, SmallTests.class })
@Tag(IOTests.TAG)
@Tag(SmallTests.TAG)
public class TestHFileCompressionLz4 extends HFileTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestHFileCompressionLz4.class);

private static Configuration conf;

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
conf.set(Compression.LZ4_CODEC_CLASS_KEY, Lz4Codec.class.getCanonicalName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,22 @@

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.compress.HFileTestBase;
import org.apache.hadoop.hbase.testclassification.IOTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category({ IOTests.class, SmallTests.class })
@Tag(IOTests.TAG)
@Tag(SmallTests.TAG)
public class TestHFileCompressionLzo extends HFileTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestHFileCompressionLzo.class);

private static Configuration conf;

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
conf.set(Compression.LZO_CODEC_CLASS_KEY, LzoCodec.class.getCanonicalName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,22 @@

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.compress.HFileTestBase;
import org.apache.hadoop.hbase.testclassification.IOTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category({ IOTests.class, SmallTests.class })
@Tag(IOTests.TAG)
@Tag(SmallTests.TAG)
public class TestHFileCompressionSnappy extends HFileTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestHFileCompressionSnappy.class);

private static Configuration conf;

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
conf.set(Compression.SNAPPY_CODEC_CLASS_KEY, SnappyCodec.class.getCanonicalName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,22 @@

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.io.compress.HFileTestBase;
import org.apache.hadoop.hbase.testclassification.IOTests;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category({ IOTests.class, SmallTests.class })
@Tag(IOTests.TAG)
@Tag(SmallTests.TAG)
public class TestHFileCompressionZstd extends HFileTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestHFileCompressionZstd.class);

private static Configuration conf;

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
conf = TEST_UTIL.getConfiguration();
conf.set(Compression.ZSTD_CODEC_CLASS_KEY, ZstdCodec.class.getCanonicalName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@
*/
package org.apache.hadoop.hbase.io.compress.aircompressor;

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.io.compress.CompressionTestBase;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category(SmallTests.class)
@Tag(SmallTests.TAG)
public class TestLz4Codec extends CompressionTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestLz4Codec.class);

@Test
public void testLz4CodecSmall() throws Exception {
codecSmallTest(new Lz4Codec());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@
*/
package org.apache.hadoop.hbase.io.compress.aircompressor;

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.io.compress.CompressionTestBase;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category(SmallTests.class)
@Tag(SmallTests.TAG)
public class TestLzoCodec extends CompressionTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestLzoCodec.class);

@Test
public void testLzoCodecSmall() throws Exception {
codecSmallTest(new LzoCodec());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,14 @@
*/
package org.apache.hadoop.hbase.io.compress.aircompressor;

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.io.compress.CompressionTestBase;
import org.apache.hadoop.hbase.testclassification.SmallTests;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category(SmallTests.class)
@Tag(SmallTests.TAG)
public class TestSnappyCodec extends CompressionTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestSnappyCodec.class);

@Test
public void testSnappyCodecSmall() throws Exception {
codecSmallTest(new SnappyCodec());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,22 @@
package org.apache.hadoop.hbase.io.compress.aircompressor;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.regionserver.wal.CompressionContext;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.wal.CompressedWALTestBase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category({ RegionServerTests.class, MediumTests.class })
@Tag(RegionServerTests.TAG)
@Tag(MediumTests.TAG)
public class TestWALCompressionLz4 extends CompressedWALTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestWALCompressionLz4.class);

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration();
conf.set(Compression.LZ4_CODEC_CLASS_KEY, Lz4Codec.class.getCanonicalName());
Expand All @@ -48,9 +44,18 @@ public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniDFSCluster(3);
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}

@Test
public void test() throws Exception {
super.test();
}

@Test
public void testLarge() throws Exception {
super.testLarge();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,22 @@
package org.apache.hadoop.hbase.io.compress.aircompressor;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.io.compress.Compression;
import org.apache.hadoop.hbase.regionserver.wal.CompressionContext;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.RegionServerTests;
import org.apache.hadoop.hbase.wal.CompressedWALTestBase;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category({ RegionServerTests.class, MediumTests.class })
@Tag(RegionServerTests.TAG)
@Tag(MediumTests.TAG)
public class TestWALCompressionLzo extends CompressedWALTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestWALCompressionLzo.class);

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration();
conf.set(Compression.LZO_CODEC_CLASS_KEY, LzoCodec.class.getCanonicalName());
Expand All @@ -48,8 +44,18 @@ public static void setUpBeforeClass() throws Exception {
TEST_UTIL.startMiniDFSCluster(3);
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
TEST_UTIL.shutdownMiniCluster();
}

@Test
public void test() throws Exception {
super.test();
}

@Test
public void testLarge() throws Exception {
super.testLarge();
}
}
Loading
Loading