HBASE-26921 Rewrite the counting cells part in TestMultiVersions (#4316)
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / wal / TestCompressedWALValueCompression.java
blob8e282e89eb386bb9e4ad58994a43fdd4b5edc4f2
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
18 package org.apache.hadoop.hbase.wal;
20 import java.util.List;
22 import org.apache.hadoop.hbase.HBaseClassTestRule;
23 import org.apache.hadoop.hbase.HBaseCommonTestingUtil;
24 import org.apache.hadoop.hbase.HBaseTestingUtil;
25 import org.apache.hadoop.hbase.HConstants;
26 import org.apache.hadoop.hbase.TableName;
27 import org.apache.hadoop.hbase.io.compress.Compression;
28 import org.apache.hadoop.hbase.regionserver.wal.CompressionContext;
29 import org.apache.hadoop.hbase.testclassification.MediumTests;
30 import org.apache.hadoop.hbase.testclassification.RegionServerTests;
31 import org.junit.After;
32 import org.junit.Before;
33 import org.junit.ClassRule;
34 import org.junit.Rule;
35 import org.junit.Test;
36 import org.junit.experimental.categories.Category;
37 import org.junit.rules.TestName;
38 import org.junit.runner.RunWith;
39 import org.junit.runners.Parameterized;
40 import org.junit.runners.Parameterized.Parameters;
42 @RunWith(Parameterized.class)
43 @Category({ RegionServerTests.class, MediumTests.class })
44 public class TestCompressedWALValueCompression extends CompressedWALTestBase {
46 @ClassRule
47 public static final HBaseClassTestRule CLASS_RULE =
48 HBaseClassTestRule.forClass(TestCompressedWALValueCompression.class);
50 private static final HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil();
52 @Parameters
53 public static List<Object[]> params() {
54 return HBaseCommonTestingUtil.COMPRESSION_ALGORITHMS_PARAMETERIZED;
57 @Rule
58 public TestName name = new TestName();
60 private final Compression.Algorithm compression;
62 public TestCompressedWALValueCompression(Compression.Algorithm algo) {
63 this.compression = algo;
66 @Before
67 public void setUp() throws Exception {
68 TEST_UTIL.getConfiguration()
69 .setBoolean(HConstants.ENABLE_WAL_COMPRESSION, true);
70 TEST_UTIL.getConfiguration()
71 .setBoolean(CompressionContext.ENABLE_WAL_VALUE_COMPRESSION, true);
72 TEST_UTIL.getConfiguration()
73 .set(CompressionContext.WAL_VALUE_COMPRESSION_TYPE, compression.getName());
74 TEST_UTIL.startMiniDFSCluster(3);
77 @After
78 public void tearDown() throws Exception {
79 TEST_UTIL.shutdownMiniCluster();
82 @Test
83 public void test() throws Exception {
84 TableName tableName = TableName.valueOf(name.getMethodName().replaceAll("[^a-zA-Z0-9]", "_"));
85 doTest(tableName);