petersomogyi commented on a change in pull request #1003: HBASE-23662 : Replace
HColumnDescriptor(String cf) with ColumnFamilyD…
URL: https://github.com/apache/hbase/pull/1003#discussion_r364634022
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEncryptionKeyRotation.java
##########
@@ -105,50 +104,56 @@ public static void tearDown() throws Exception {
@Test
public void testCFKeyRotation() throws Exception {
// Create the table schema
- HTableDescriptor htd = new HTableDescriptor(TableName.valueOf("default",
name.getMethodName()));
- HColumnDescriptor hcd = new HColumnDescriptor("cf");
+ TableDescriptorBuilder tableDescriptorBuilder =
+ TableDescriptorBuilder.newBuilder(TableName.valueOf("default",
name.getMethodName()));
+ ColumnFamilyDescriptorBuilder columnFamilyDescriptorBuilder =
+ ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes("cf"));
String algorithm =
- conf.get(HConstants.CRYPTO_KEY_ALGORITHM_CONF_KEY,
HConstants.CIPHER_AES);
- hcd.setEncryptionType(algorithm);
- hcd.setEncryptionKey(EncryptionUtil.wrapKey(conf, "hbase", initialCFKey));
- htd.addFamily(hcd);
+ conf.get(HConstants.CRYPTO_KEY_ALGORITHM_CONF_KEY,
HConstants.CIPHER_AES);
+ columnFamilyDescriptorBuilder.setEncryptionType(algorithm);
+
columnFamilyDescriptorBuilder.setEncryptionKey(EncryptionUtil.wrapKey(conf,
"hbase",
+ initialCFKey));
+
tableDescriptorBuilder.setColumnFamily(columnFamilyDescriptorBuilder.build());
// Create the table and some on disk files
- createTableAndFlush(htd);
+ createTableAndFlush(tableDescriptorBuilder.build());
Review comment:
It might worth to extract tableDescriptorBuilder.build() to a variable since
it is used in many places.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services