### Question:
OMKeyCommitResponse extends OMClientResponse { @Override public void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { omMetadataManager.getOpenKeyTable().deleteWithBatch(batchOperation, openKeyName); omMetadataManager.getKeyTable().putWithBatch(batchOperation, ozoneKeyName, omKeyInfo); omMetadataManager.getVolumeTable().putWithBatch(batchOperation, omMetadataManager.getVolumeKey(omVolumeArgs.getVolume()), omVolumeArgs); omMetadataManager.getBucketTable().putWithBatch(batchOperation, omMetadataManager.getBucketKey(omVolumeArgs.getVolume(), omBucketInfo.getBucketName()), omBucketInfo); } OMKeyCommitResponse(@Nonnull OMResponse omResponse,
      @Nonnull OmKeyInfo omKeyInfo, String ozoneKeyName, String openKeyName,
      @Nonnull OmVolumeArgs omVolumeArgs, @Nonnull OmBucketInfo omBucketInfo);  OMKeyCommitResponse(@Nonnull OMResponse omResponse); @Override void addToDBBatch(OMMetadataManager omMetadataManager,
      BatchOperation batchOperation);  }### Answer:
@Test public void testAddToDBBatch() throws Exception { OmKeyInfo omKeyInfo = TestOMRequestUtils.createOmKeyInfo(volumeName, bucketName, keyName, replicationType, replicationFactor); OmVolumeArgs omVolumeArgs = OmVolumeArgs.newBuilder() .setOwnerName(keyName).setAdminName(keyName) .setVolume(volumeName).setCreationTime(Time.now()).build(); OmBucketInfo omBucketInfo = OmBucketInfo.newBuilder() .setVolumeName(volumeName).setBucketName(bucketName) .setCreationTime(Time.now()).build(); OzoneManagerProtocolProtos.OMResponse omResponse = OzoneManagerProtocolProtos.OMResponse.newBuilder().setCommitKeyResponse( OzoneManagerProtocolProtos.CommitKeyResponse.getDefaultInstance()) .setStatus(OzoneManagerProtocolProtos.Status.OK) .setCmdType(OzoneManagerProtocolProtos.Type.CommitKey) .build(); TestOMRequestUtils.addKeyToTable(true, volumeName, bucketName, keyName, clientID, replicationType, replicationFactor, omMetadataManager); String openKey = omMetadataManager.getOpenKey(volumeName, bucketName, keyName, clientID); Assert.assertTrue(omMetadataManager.getOpenKeyTable().isExist(openKey)); String ozoneKey = omMetadataManager.getOzoneKey(volumeName, bucketName, keyName); OMKeyCommitResponse omKeyCommitResponse = new OMKeyCommitResponse( omResponse, omKeyInfo, ozoneKey, openKey, omVolumeArgs, omBucketInfo); omKeyCommitResponse.addToDBBatch(omMetadataManager, batchOperation); omMetadataManager.getStore().commitBatchOperation(batchOperation); Assert.assertFalse(omMetadataManager.getOpenKeyTable().isExist(openKey)); Assert.assertTrue(omMetadataManager.getKeyTable().isExist( omMetadataManager.getOzoneKey(volumeName, bucketName, keyName))); }