### Question:
OMKeyCreateResponse extends OMClientResponse { @Override protected void addToDBBatch(OMMetadataManager omMetadataManager, BatchOperation batchOperation) throws IOException { if (parentKeyInfos != null) { for (OmKeyInfo parentKeyInfo : parentKeyInfos) { String parentKey = omMetadataManager .getOzoneDirKey(parentKeyInfo.getVolumeName(), parentKeyInfo.getBucketName(), parentKeyInfo.getKeyName()); if (LOG.isDebugEnabled()) { LOG.debug("putWithBatch adding parent : key {} info : {}", parentKey, parentKeyInfo); } omMetadataManager.getKeyTable() .putWithBatch(batchOperation, parentKey, parentKeyInfo); } } String openKey = omMetadataManager.getOpenKey(omKeyInfo.getVolumeName(), omKeyInfo.getBucketName(), omKeyInfo.getKeyName(), openKeySessionID); omMetadataManager.getOpenKeyTable().putWithBatch(batchOperation, openKey, omKeyInfo); omMetadataManager.getVolumeTable().putWithBatch(batchOperation, omMetadataManager.getVolumeKey(omVolumeArgs.getVolume()), omVolumeArgs); omMetadataManager.getBucketTable().putWithBatch(batchOperation, omMetadataManager.getBucketKey(omVolumeArgs.getVolume(), omBucketInfo.getBucketName()), omBucketInfo); } OMKeyCreateResponse(@Nonnull OMResponse omResponse,
      @Nonnull OmKeyInfo omKeyInfo, List<OmKeyInfo> parentKeyInfos,
      long openKeySessionID, @Nonnull OmVolumeArgs omVolumeArgs,
      @Nonnull OmBucketInfo omBucketInfo);  OMKeyCreateResponse(@Nonnull OMResponse omResponse);  static final Logger LOG; }### 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(); OMResponse omResponse = OMResponse.newBuilder().setCreateKeyResponse( CreateKeyResponse.getDefaultInstance()) .setStatus(OzoneManagerProtocolProtos.Status.OK) .setCmdType(OzoneManagerProtocolProtos.Type.CreateKey) .build(); OMKeyCreateResponse omKeyCreateResponse = new OMKeyCreateResponse(omResponse, omKeyInfo, null, clientID, omVolumeArgs, omBucketInfo); String openKey = omMetadataManager.getOpenKey(volumeName, bucketName, keyName, clientID); Assert.assertFalse(omMetadataManager.getOpenKeyTable().isExist(openKey)); omKeyCreateResponse.addToDBBatch(omMetadataManager, batchOperation); omMetadataManager.getStore().commitBatchOperation(batchOperation); Assert.assertTrue(omMetadataManager.getOpenKeyTable().isExist(openKey)); }