Apache9 commented on a change in pull request #1840: URL: https://github.com/apache/hbase/pull/1840#discussion_r434450669
########## File path: hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestRegionInfoBuilder.java ########## @@ -302,30 +283,28 @@ public void testConvert() { HBaseProtos.RegionInfo info = HBaseProtos.RegionInfo.newBuilder() .setTableName(HBaseProtos.TableName.newBuilder() .setQualifier(UnsafeByteOperations.unsafeWrap(tableName.getQualifier())) - .setNamespace(UnsafeByteOperations.unsafeWrap(tableName.getNamespace())) - .build()) + .setNamespace(UnsafeByteOperations.unsafeWrap(tableName.getNamespace())).build()) .setStartKey(UnsafeByteOperations.unsafeWrap(startKey)) - .setEndKey(UnsafeByteOperations.unsafeWrap(endKey)) - .setSplit(split) - .setRegionId(regionId) + .setEndKey(UnsafeByteOperations.unsafeWrap(endKey)).setSplit(split).setRegionId(regionId) .build(); convertedRi = ProtobufUtil.toRegionInfo(info); - RegionInfo expectedRi = RegionInfoBuilder.newBuilder(tableName) - .setStartKey(startKey) - .setEndKey(endKey) - .setSplit(split) - .setRegionId(regionId) - .setReplicaId(0).build(); + RegionInfo expectedRi = RegionInfoBuilder.newBuilder(tableName).setStartKey(startKey) + .setEndKey(endKey).setSplit(split).setRegionId(regionId).setReplicaId(0).build(); assertEquals(expectedRi, convertedRi); } - // Duplicated method in TestRegionInfoDisplay too. - private HRegionInfo convert(RegionInfo ri) { - HRegionInfo hri = new HRegionInfo( - ri.getTable(), ri.getStartKey(), ri.getEndKey(), ri.isSplit(), ri.getRegionId()); - hri.setOffline(ri.isOffline()); - return hri; + @Test + public void testNewBuilderWithRegionInfo() { + RegionInfo ri = RegionInfoBuilder.newBuilder(name.getTableName()).build(); + RegionInfo ri2 = RegionInfoBuilder.newBuilder(ri).build(); + assertEquals(ri, ri2); + + // make sure that the region name and encoded name are changed, see HBASE-24500 for more + // details. Review comment: For example? I think this is enough? ---------------------------------------------------------------- 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: us...@infra.apache.org