HBASE-24033 Add ut for loading the corrupt recovered hfiles (#1322)
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / HTestConst.java
blob268f79cfa1878154cef6631b453c2ee21c9b05ee
1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with this
4 * work for additional information regarding copyright ownership. The ASF
5 * licenses this file to you under the Apache License, Version 2.0 (the
6 * "License"); you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations
15 * under the License.
17 package org.apache.hadoop.hbase;
19 import java.util.Arrays;
20 import java.util.HashSet;
21 import java.util.Set;
22 import java.util.Collections;
24 import org.apache.hadoop.hbase.util.Bytes;
26 /**
27 * Similar to {@link HConstants} but for tests. Also provides some simple
28 * static utility functions to generate test data.
30 public class HTestConst {
32 private HTestConst() {
35 public static final String DEFAULT_TABLE_STR = "MyTestTable";
36 public static final byte[] DEFAULT_TABLE_BYTES = Bytes.toBytes(DEFAULT_TABLE_STR);
37 public static final TableName DEFAULT_TABLE =
38 TableName.valueOf(DEFAULT_TABLE_BYTES);
40 public static final String DEFAULT_CF_STR = "MyDefaultCF";
41 public static final byte[] DEFAULT_CF_BYTES = Bytes.toBytes(DEFAULT_CF_STR);
43 public static final Set<String> DEFAULT_CF_STR_SET =
44 Collections.unmodifiableSet(new HashSet<>(
45 Arrays.asList(new String[] { DEFAULT_CF_STR })));
47 public static final String DEFAULT_ROW_STR = "MyTestRow";
48 public static final byte[] DEFAULT_ROW_BYTES = Bytes.toBytes(DEFAULT_ROW_STR);
50 public static final String DEFAULT_QUALIFIER_STR = "MyColumnQualifier";
51 public static final byte[] DEFAULT_QUALIFIER_BYTES = Bytes.toBytes(DEFAULT_QUALIFIER_STR);
53 public static String DEFAULT_VALUE_STR = "MyTestValue";
54 public static byte[] DEFAULT_VALUE_BYTES = Bytes.toBytes(DEFAULT_VALUE_STR);
56 /**
57 * Generate the given number of unique byte sequences by appending numeric
58 * suffixes (ASCII representations of decimal numbers).
60 public static byte[][] makeNAscii(byte[] base, int n) {
61 byte [][] ret = new byte[n][];
62 for (int i = 0; i < n; i++) {
63 byte[] tail = Bytes.toBytes(Integer.toString(i));
64 ret[i] = Bytes.add(base, tail);
66 return ret;