PBHelper { public static NamenodeRole convert(NamenodeRoleProto role) { switch (role) { case NAMENODE: return NamenodeRole.NAMENODE; case BACKUP: return NamenodeRole.BACKUP; case CHECKPOINT: return NamenodeRole.CHECKPOINT; } return null; } private  PBHelper(); static NamenodeRole convert(NamenodeRoleProto role); static NamenodeRoleProto convert(NamenodeRole role); static StorageInfoProto convert(StorageInfo info); static StorageInfo convert(StorageInfoProto info, NodeType type); static NamenodeRegistrationProto convert(NamenodeRegistration reg); static NamenodeRegistration convert(NamenodeRegistrationProto reg); static BlockWithLocationsProto convert(BlockWithLocations blk); static BlockWithLocations convert(BlockWithLocationsProto b); static BlocksWithLocationsProto convert(BlocksWithLocations blks); static BlocksWithLocations convert(BlocksWithLocationsProto blocks); static BlockKeyProto convert(BlockKey key); static BlockKey convert(BlockKeyProto k); static ExportedBlockKeysProto convert(ExportedBlockKeys keys); static ExportedBlockKeys convert(ExportedBlockKeysProto keys); static CheckpointSignatureProto convert(CheckpointSignature s); static CheckpointSignature convert(CheckpointSignatureProto s); static RemoteEditLogProto convert(RemoteEditLog log); static RemoteEditLog convert(RemoteEditLogProto l); static RemoteEditLogManifestProto convert(
      RemoteEditLogManifest manifest); static RemoteEditLogManifest convert(
      RemoteEditLogManifestProto manifest); static CheckpointCommandProto convert(CheckpointCommand cmd); static NamenodeCommandProto convert(NamenodeCommand cmd); static BlockKey[] convertBlockKeys(List<BlockKeyProto> list); static NamespaceInfo convert(NamespaceInfoProto info); static NamenodeCommand convert(NamenodeCommandProto cmd); static RecoveringBlockProto convert(RecoveringBlock b); static RecoveringBlock convert(RecoveringBlockProto b); static ReplicaState convert(ReplicaStateProto state); static ReplicaStateProto convert(ReplicaState state); static DatanodeRegistrationProto convert(
      DatanodeRegistration registration); static DatanodeRegistration convert(DatanodeRegistrationProto proto); static DatanodeCommand convert(DatanodeCommandProto proto); static BalancerBandwidthCommandProto convert(
      BalancerBandwidthCommand bbCmd); static KeyUpdateCommandProto convert(KeyUpdateCommand cmd); static BlockRecoveryCommandProto convert(BlockRecoveryCommand cmd); static FinalizeCommandProto convert(FinalizeCommand cmd); static BlockCommandProto convert(BlockCommand cmd); static BlockIdCommandProto convert(BlockIdCommand cmd); static DatanodeCommandProto convert(DatanodeCommand datanodeCommand); static KeyUpdateCommand convert(KeyUpdateCommandProto keyUpdateCmd); static FinalizeCommand convert(FinalizeCommandProto finalizeCmd); static BlockRecoveryCommand convert(
      BlockRecoveryCommandProto recoveryCmd); static BlockCommand convert(BlockCommandProto blkCmd); static BlockIdCommand convert(BlockIdCommandProto blkIdCmd); static BalancerBandwidthCommand convert(
      BalancerBandwidthCommandProto balancerCmd); static ReceivedDeletedBlockInfoProto convert(
      ReceivedDeletedBlockInfo receivedDeletedBlockInfo); static ReceivedDeletedBlockInfo convert(
      ReceivedDeletedBlockInfoProto proto); static NamespaceInfoProto convert(NamespaceInfo info); static HAServiceState convert(NNHAStatusHeartbeatProto.State s); static NNHAStatusHeartbeatProto.State convert(HAServiceState s); static NNHAStatusHeartbeat convert(NNHAStatusHeartbeatProto s); static NNHAStatusHeartbeatProto convert(NNHAStatusHeartbeat hb); static VolumeFailureSummary convertVolumeFailureSummary(
      VolumeFailureSummaryProto proto); static VolumeFailureSummaryProto convertVolumeFailureSummary(
      VolumeFailureSummary volumeFailureSummary); static List<SlowPeerReportProto> convertSlowPeerInfo(
      SlowPeerReports slowPeers); static SlowPeerReports convertSlowPeerInfo(
      List<SlowPeerReportProto> slowPeerProtos); static List<SlowDiskReportProto> convertSlowDiskInfo(
      SlowDiskReports slowDisks); static SlowDiskReports convertSlowDiskInfo(
      List<SlowDiskReportProto> slowDiskProtos); static JournalInfo convert(JournalInfoProto info); static JournalInfoProto convert(JournalInfo j); static BlockReportContext convert(BlockReportContextProto proto); static BlockReportContextProto convert(BlockReportContext context); static BlockECReconstructionInfo convertBlockECReconstructionInfo(
      BlockECReconstructionInfoProto blockEcReconstructionInfoProto); static BlockECReconstructionInfoProto convertBlockECRecoveryInfo(
      BlockECReconstructionInfo blockEcRecoveryInfo); static BlockECReconstructionCommandProto convert(
      BlockECReconstructionCommand blkECReconstructionCmd); static BlockECReconstructionCommand convert(
      BlockECReconstructionCommandProto blkECReconstructionCmdProto); static KeyValueProto convert(FileRegion fileRegion); static FileRegion convert(KeyValueProto keyValueProto);  }
@Test public void testConvertNamenodeRole() { assertEquals(NamenodeRoleProto.BACKUP, PBHelper.convert(NamenodeRole.BACKUP)); assertEquals(NamenodeRoleProto.CHECKPOINT, PBHelper.convert(NamenodeRole.CHECKPOINT)); assertEquals(NamenodeRoleProto.NAMENODE, PBHelper.convert(NamenodeRole.NAMENODE)); assertEquals(NamenodeRole.BACKUP, PBHelper.convert(NamenodeRoleProto.BACKUP)); assertEquals(NamenodeRole.CHECKPOINT, PBHelper.convert(NamenodeRoleProto.CHECKPOINT)); assertEquals(NamenodeRole.NAMENODE, PBHelper.convert(NamenodeRoleProto.NAMENODE)); }
@Test public void testConvertStoragInfo() { StorageInfo info = getStorageInfo(NodeType.NAME_NODE); StorageInfoProto infoProto = PBHelper.convert(info); StorageInfo info2 = PBHelper.convert(infoProto, NodeType.NAME_NODE); assertEquals(info.getClusterID(), info2.getClusterID()); assertEquals(info.getCTime(), info2.getCTime()); assertEquals(info.getLayoutVersion(), info2.getLayoutVersion()); assertEquals(info.getNamespaceID(), info2.getNamespaceID()); }
@Test public void testConvertNamenodeRegistration() { StorageInfo info = getStorageInfo(NodeType.NAME_NODE); NamenodeRegistration reg = new NamenodeRegistration("address:999", "http:1000", info, NamenodeRole.NAMENODE); NamenodeRegistrationProto regProto = PBHelper.convert(reg); NamenodeRegistration reg2 = PBHelper.convert(regProto); assertEquals(reg.getAddress(), reg2.getAddress()); assertEquals(reg.getClusterID(), reg2.getClusterID()); assertEquals(reg.getCTime(), reg2.getCTime()); assertEquals(reg.getHttpAddress(), reg2.getHttpAddress()); assertEquals(reg.getLayoutVersion(), reg2.getLayoutVersion()); assertEquals(reg.getNamespaceID(), reg2.getNamespaceID()); assertEquals(reg.getRegistrationID(), reg2.getRegistrationID()); assertEquals(reg.getRole(), reg2.getRole()); assertEquals(reg.getVersion(), reg2.getVersion()); }
@Test public void testConvertDatanodeID() { DatanodeID dn = DFSTestUtil.getLocalDatanodeID(); DatanodeIDProto dnProto = PBHelperClient.convert(dn); DatanodeID dn2 = PBHelperClient.convert(dnProto); compare(dn, dn2); }
@Test public void testConvertBlock() { Block b = new Block(1, 100, 3); BlockProto bProto = PBHelperClient.convert(b); Block b2 = PBHelperClient.convert(bProto); assertEquals(b, b2); }
@Test public void testConvertBlockType() { BlockType bContiguous = BlockType.CONTIGUOUS; BlockTypeProto bContiguousProto = PBHelperClient.convert(bContiguous); BlockType bContiguous2 = PBHelperClient.convert(bContiguousProto); assertEquals(bContiguous, bContiguous2); BlockType bStriped = BlockType.STRIPED; BlockTypeProto bStripedProto = PBHelperClient.convert(bStriped); BlockType bStriped2 = PBHelperClient.convert(bStripedProto); assertEquals(bStriped, bStriped2); }
@Test public void testConvertBlockWithLocations() { boolean[] testSuite = new boolean[]{false, true}; for (int i = 0; i < testSuite.length; i++) { BlockWithLocations locs = getBlockWithLocations(1, testSuite[i]); BlockWithLocationsProto locsProto = PBHelper.convert(locs); BlockWithLocations locs2 = PBHelper.convert(locsProto); compare(locs, locs2); } }
@Test public void testConvertBlocksWithLocations() { boolean[] testSuite = new boolean[]{false, true}; for (int i = 0; i < testSuite.length; i++) { BlockWithLocations[] list = new BlockWithLocations[]{ getBlockWithLocations(1, testSuite[i]), getBlockWithLocations(2, testSuite[i])}; BlocksWithLocations locs = new BlocksWithLocations(list); BlocksWithLocationsProto locsProto = PBHelper.convert(locs); BlocksWithLocations locs2 = PBHelper.convert(locsProto); BlockWithLocations[] blocks = locs.getBlocks(); BlockWithLocations[] blocks2 = locs2.getBlocks(); assertEquals(blocks.length, blocks2.length); for (int j = 0; j < blocks.length; j++) { compare(blocks[j], blocks2[j]); } } }
@Test public void testConvertBlockKey() { BlockKey key = getBlockKey(1); BlockKeyProto keyProto = PBHelper.convert(key); BlockKey key1 = PBHelper.convert(keyProto); compare(key, key1); }
@Test public void testConvertExportedBlockKeys() { BlockKey[] keys = new BlockKey[] { getBlockKey(2), getBlockKey(3) }; ExportedBlockKeys expKeys = new ExportedBlockKeys(true, 9, 10, getBlockKey(1), keys); ExportedBlockKeysProto expKeysProto = PBHelper.convert(expKeys); ExportedBlockKeys expKeys1 = PBHelper.convert(expKeysProto); compare(expKeys, expKeys1); }
@Test public void testConvertCheckpointSignature() { CheckpointSignature s = new CheckpointSignature( getStorageInfo(NodeType.NAME_NODE), "bpid", 100, 1); CheckpointSignatureProto sProto = PBHelper.convert(s); CheckpointSignature s1 = PBHelper.convert(sProto); assertEquals(s.getBlockpoolID(), s1.getBlockpoolID()); assertEquals(s.getClusterID(), s1.getClusterID()); assertEquals(s.getCTime(), s1.getCTime()); assertEquals(s.getCurSegmentTxId(), s1.getCurSegmentTxId()); assertEquals(s.getLayoutVersion(), s1.getLayoutVersion()); assertEquals(s.getMostRecentCheckpointTxId(), s1.getMostRecentCheckpointTxId()); assertEquals(s.getNamespaceID(), s1.getNamespaceID()); }
@Test public void testConvertRemoteEditLog() { RemoteEditLog l = new RemoteEditLog(1, 100); RemoteEditLogProto lProto = PBHelper.convert(l); RemoteEditLog l1 = PBHelper.convert(lProto); compare(l, l1); }
@Test public void testConvertExtendedBlock() { ExtendedBlock b = getExtendedBlock(); ExtendedBlockProto bProto = PBHelperClient.convert(b); ExtendedBlock b1 = PBHelperClient.convert(bProto); assertEquals(b, b1); b.setBlockId(-1); bProto = PBHelperClient.convert(b); b1 = PBHelperClient.convert(bProto); assertEquals(b, b1); }
@Test public void testConvertRecoveringBlock() { DatanodeInfo di1 = DFSTestUtil.getLocalDatanodeInfo(); DatanodeInfo di2 = DFSTestUtil.getLocalDatanodeInfo(); DatanodeInfo[] dnInfo = new DatanodeInfo[] { di1, di2 }; RecoveringBlock b = new RecoveringBlock(getExtendedBlock(), dnInfo, 3); RecoveringBlockProto bProto = PBHelper.convert(b); RecoveringBlock b1 = PBHelper.convert(bProto); assertEquals(b.getBlock(), b1.getBlock()); DatanodeInfo[] dnInfo1 = b1.getLocations(); assertEquals(dnInfo.length, dnInfo1.length); for (int i=0; i < dnInfo.length; i++) { compare(dnInfo[0], dnInfo1[0]); } }
@Test public void testConvertBlockRecoveryCommand() { DatanodeInfo di1 = DFSTestUtil.getLocalDatanodeInfo(); DatanodeInfo di2 = DFSTestUtil.getLocalDatanodeInfo(); DatanodeInfo[] dnInfo = new DatanodeInfo[] { di1, di2 }; List<RecoveringBlock> blks = ImmutableList.of( new RecoveringBlock(getExtendedBlock(1), dnInfo, 3), new RecoveringBlock(getExtendedBlock(2), dnInfo, 3) ); BlockRecoveryCommand cmd = new BlockRecoveryCommand(blks); BlockRecoveryCommandProto proto = PBHelper.convert(cmd); assertEquals(1, proto.getBlocks(0).getBlock().getB().getBlockId()); assertEquals(2, proto.getBlocks(1).getBlock().getB().getBlockId()); BlockRecoveryCommand cmd2 = PBHelper.convert(proto); List<RecoveringBlock> cmd2Blks = Lists.newArrayList( cmd2.getRecoveringBlocks()); assertEquals(blks.get(0).getBlock(), cmd2Blks.get(0).getBlock()); assertEquals(blks.get(1).getBlock(), cmd2Blks.get(1).getBlock()); assertEquals(Joiner.on(",").join(blks), Joiner.on(",").join(cmd2Blks)); assertEquals(cmd.toString(), cmd2.toString()); }
@Test public void testConvertBlockToken() { Token<BlockTokenIdentifier> token = new Token<BlockTokenIdentifier>( "identifier".getBytes(), "password".getBytes(), new Text("kind"), new Text("service")); TokenProto tokenProto = PBHelperClient.convert(token); Token<BlockTokenIdentifier> token2 = PBHelperClient.convert(tokenProto); compare(token, token2); }
@Test public void testConvertNamespaceInfo() { NamespaceInfo info = new NamespaceInfo(37, "clusterID", "bpID", 2300); NamespaceInfoProto proto = PBHelper.convert(info); NamespaceInfo info2 = PBHelper.convert(proto); compare(info, info2); assertEquals(info.getBlockPoolID(), info2.getBlockPoolID()); assertEquals(info.getBuildVersion(), info2.getBuildVersion()); }
@Test public void testConvertDatanodeRegistration() { DatanodeID dnId = DFSTestUtil.getLocalDatanodeID(); BlockKey[] keys = new BlockKey[] { getBlockKey(2), getBlockKey(3) }; ExportedBlockKeys expKeys = new ExportedBlockKeys(true, 9, 10, getBlockKey(1), keys); DatanodeRegistration reg = new DatanodeRegistration(dnId, new StorageInfo(NodeType.DATA_NODE), expKeys, "3.0.0"); DatanodeRegistrationProto proto = PBHelper.convert(reg); DatanodeRegistration reg2 = PBHelper.convert(proto); compare(reg.getStorageInfo(), reg2.getStorageInfo()); compare(reg.getExportedKeys(), reg2.getExportedKeys()); compare(reg, reg2); assertEquals(reg.getSoftwareVersion(), reg2.getSoftwareVersion()); }
@Test public void TestConvertDatanodeStorage() { DatanodeStorage dns1 = new DatanodeStorage( "id1", DatanodeStorage.State.NORMAL, StorageType.SSD); DatanodeStorageProto proto = PBHelperClient.convert(dns1); DatanodeStorage dns2 = PBHelperClient.convert(proto); compare(dns1, dns2); }
@Test public void testConvertBlockCommand() { Block[] blocks = new Block[] { new Block(21), new Block(22) }; DatanodeInfo[][] dnInfos = new DatanodeInfo[][] { new DatanodeInfo[1], new DatanodeInfo[2] }; dnInfos[0][0] = DFSTestUtil.getLocalDatanodeInfo(); dnInfos[1][0] = DFSTestUtil.getLocalDatanodeInfo(); dnInfos[1][1] = DFSTestUtil.getLocalDatanodeInfo(); String[][] storageIDs = {{"s00"}, {"s10", "s11"}}; StorageType[][] storageTypes = {{StorageType.DEFAULT}, {StorageType.DEFAULT, StorageType.DEFAULT}}; BlockCommand bc = new BlockCommand(DatanodeProtocol.DNA_TRANSFER, "bp1", blocks, dnInfos, storageTypes, storageIDs); BlockCommandProto bcProto = PBHelper.convert(bc); BlockCommand bc2 = PBHelper.convert(bcProto); assertEquals(bc.getAction(), bc2.getAction()); assertEquals(bc.getBlocks().length, bc2.getBlocks().length); Block[] blocks2 = bc2.getBlocks(); for (int i = 0; i < blocks.length; i++) { assertEquals(blocks[i], blocks2[i]); } DatanodeInfo[][] dnInfos2 = bc2.getTargets(); assertEquals(dnInfos.length, dnInfos2.length); for (int i = 0; i < dnInfos.length; i++) { DatanodeInfo[] d1 = dnInfos[i]; DatanodeInfo[] d2 = dnInfos2[i]; assertEquals(d1.length, d2.length); for (int j = 0; j < d1.length; j++) { compare(d1[j], d2[j]); } } }
@Test public void testChecksumTypeProto() { assertEquals(DataChecksum.Type.NULL, PBHelperClient.convert(HdfsProtos.ChecksumTypeProto.CHECKSUM_NULL)); assertEquals(DataChecksum.Type.CRC32, PBHelperClient.convert(HdfsProtos.ChecksumTypeProto.CHECKSUM_CRC32)); assertEquals(DataChecksum.Type.CRC32C, PBHelperClient.convert(HdfsProtos.ChecksumTypeProto.CHECKSUM_CRC32C)); assertEquals(PBHelperClient.convert(DataChecksum.Type.NULL), HdfsProtos.ChecksumTypeProto.CHECKSUM_NULL); assertEquals(PBHelperClient.convert(DataChecksum.Type.CRC32), HdfsProtos.ChecksumTypeProto.CHECKSUM_CRC32); assertEquals(PBHelperClient.convert(DataChecksum.Type.CRC32C), HdfsProtos.ChecksumTypeProto.CHECKSUM_CRC32C); }
@Test public void testBlockChecksumTypeProto() { assertEquals(BlockChecksumType.MD5CRC, PBHelperClient.convert(HdfsProtos.BlockChecksumTypeProto.MD5CRC)); assertEquals(BlockChecksumType.COMPOSITE_CRC, PBHelperClient.convert( HdfsProtos.BlockChecksumTypeProto.COMPOSITE_CRC)); assertEquals(PBHelperClient.convert(BlockChecksumType.MD5CRC), HdfsProtos.BlockChecksumTypeProto.MD5CRC); assertEquals(PBHelperClient.convert(BlockChecksumType.COMPOSITE_CRC), HdfsProtos.BlockChecksumTypeProto.COMPOSITE_CRC); }
@Test public void testAclStatusProto() { AclEntry e = new AclEntry.Builder().setName("test") .setPermission(FsAction.READ_EXECUTE).setScope(AclEntryScope.DEFAULT) .setType(AclEntryType.OTHER).build(); AclStatus s = new AclStatus.Builder().owner("foo").group("bar").addEntry(e) .build(); Assert.assertEquals(s, PBHelperClient.convert(PBHelperClient.convert(s))); }
@Test public void testBlockECRecoveryCommand() { DatanodeInfo[] dnInfos0 = new DatanodeInfo[] { DFSTestUtil.getLocalDatanodeInfo(), DFSTestUtil.getLocalDatanodeInfo() }; DatanodeStorageInfo targetDnInfos_0 = BlockManagerTestUtil .newDatanodeStorageInfo(DFSTestUtil.getLocalDatanodeDescriptor(), new DatanodeStorage("s00")); DatanodeStorageInfo targetDnInfos_1 = BlockManagerTestUtil .newDatanodeStorageInfo(DFSTestUtil.getLocalDatanodeDescriptor(), new DatanodeStorage("s01")); DatanodeStorageInfo[] targetDnInfos0 = new DatanodeStorageInfo[] { targetDnInfos_0, targetDnInfos_1 }; byte[] liveBlkIndices0 = new byte[2]; BlockECReconstructionInfo blkECRecoveryInfo0 = new BlockECReconstructionInfo( new ExtendedBlock("bp1", 1234), dnInfos0, targetDnInfos0, liveBlkIndices0, StripedFileTestUtil.getDefaultECPolicy()); DatanodeInfo[] dnInfos1 = new DatanodeInfo[] { DFSTestUtil.getLocalDatanodeInfo(), DFSTestUtil.getLocalDatanodeInfo() }; DatanodeStorageInfo targetDnInfos_2 = BlockManagerTestUtil .newDatanodeStorageInfo(DFSTestUtil.getLocalDatanodeDescriptor(), new DatanodeStorage("s02")); DatanodeStorageInfo targetDnInfos_3 = BlockManagerTestUtil .newDatanodeStorageInfo(DFSTestUtil.getLocalDatanodeDescriptor(), new DatanodeStorage("s03")); DatanodeStorageInfo[] targetDnInfos1 = new DatanodeStorageInfo[] { targetDnInfos_2, targetDnInfos_3 }; byte[] liveBlkIndices1 = new byte[2]; BlockECReconstructionInfo blkECRecoveryInfo1 = new BlockECReconstructionInfo( new ExtendedBlock("bp2", 3256), dnInfos1, targetDnInfos1, liveBlkIndices1, StripedFileTestUtil.getDefaultECPolicy()); List<BlockECReconstructionInfo> blkRecoveryInfosList = new ArrayList<BlockECReconstructionInfo>(); blkRecoveryInfosList.add(blkECRecoveryInfo0); blkRecoveryInfosList.add(blkECRecoveryInfo1); BlockECReconstructionCommand blkECReconstructionCmd = new BlockECReconstructionCommand( DatanodeProtocol.DNA_ERASURE_CODING_RECONSTRUCTION, blkRecoveryInfosList); BlockECReconstructionCommandProto blkECRecoveryCmdProto = PBHelper .convert(blkECReconstructionCmd); blkECReconstructionCmd = PBHelper.convert(blkECRecoveryCmdProto); Iterator<BlockECReconstructionInfo> iterator = blkECReconstructionCmd.getECTasks() .iterator(); assertBlockECRecoveryInfoEquals(blkECRecoveryInfo0, iterator.next()); assertBlockECRecoveryInfoEquals(blkECRecoveryInfo1, iterator.next()); }
@Test public void testDataNodeInfoPBHelper() { DatanodeID id = DFSTestUtil.getLocalDatanodeID(); DatanodeInfo dnInfos0 = new DatanodeInfoBuilder().setNodeID(id) .build(); dnInfos0.setCapacity(3500L); dnInfos0.setDfsUsed(1000L); dnInfos0.setNonDfsUsed(2000L); dnInfos0.setRemaining(500L); HdfsProtos.DatanodeInfoProto dnproto = PBHelperClient.convert(dnInfos0); DatanodeInfo dnInfos1 = PBHelperClient.convert(dnproto); compare(dnInfos0, dnInfos1); assertEquals(dnInfos0.getNonDfsUsed(), dnInfos1.getNonDfsUsed()); HdfsProtos.DatanodeInfoProto.Builder b = HdfsProtos.DatanodeInfoProto.newBuilder(); b.setId(PBHelperClient.convert(id)).setCapacity(3500L).setDfsUsed(1000L) .setRemaining(500L); DatanodeInfo dnInfos3 = PBHelperClient.convert(b.build()); assertEquals(dnInfos0.getNonDfsUsed(), dnInfos3.getNonDfsUsed()); }
@Test public void testFSServerDefaultsHelper() { HdfsProtos.FsServerDefaultsProto.Builder b = HdfsProtos.FsServerDefaultsProto .newBuilder(); b.setBlockSize(DFSConfigKeys.DFS_BLOCK_SIZE_DEFAULT); b.setBytesPerChecksum(DFSConfigKeys.DFS_BYTES_PER_CHECKSUM_DEFAULT); b.setWritePacketSize( HdfsClientConfigKeys.DFS_CLIENT_WRITE_PACKET_SIZE_DEFAULT); b.setReplication(DFSConfigKeys.DFS_REPLICATION_DEFAULT); b.setFileBufferSize(DFSConfigKeys.IO_FILE_BUFFER_SIZE_DEFAULT); b.setEncryptDataTransfer(DFSConfigKeys.DFS_ENCRYPT_DATA_TRANSFER_DEFAULT); b.setTrashInterval(DFSConfigKeys.FS_TRASH_INTERVAL_DEFAULT); b.setChecksumType(HdfsProtos.ChecksumTypeProto.forNumber( DataChecksum.Type.valueOf(DFSConfigKeys.DFS_CHECKSUM_TYPE_DEFAULT).id)); HdfsProtos.FsServerDefaultsProto proto = b.build(); assertFalse("KeyProvider uri is not supported", proto.hasKeyProviderUri()); FsServerDefaults fsServerDefaults = PBHelperClient.convert(proto); Assert.assertNotNull("FsServerDefaults is null", fsServerDefaults); Assert.assertNull("KeyProviderUri should be null", fsServerDefaults.getKeyProviderUri()); }