@Test public void testUndelete() throws Exception { mockBlobExistence(true); assertEquals(0, azureDest.undeleteBlob(blobId, (short) 0, dummyCloudUpdateValidator)); assertEquals(1, azureMetrics.blobUpdatedCount.getCount()); assertEquals(0, azureMetrics.blobUpdateErrorCount.getCount()); assertEquals(1, azureMetrics.blobUpdateTime.getCount()); assertEquals(1, azureMetrics.documentReadTime.getCount()); assertEquals(1, azureMetrics.documentUpdateTime.getCount()); }
@Override public short undeleteBlob(BlobId blobId, short lifeVersion, CloudUpdateValidator cloudUpdateValidator) throws CloudStorageException { Map<String, Object> updateFields = new HashMap<>(); updateFields.put(CloudBlobMetadata.FIELD_LIFE_VERSION, lifeVersion); updateFields.put(CloudBlobMetadata.FIELD_DELETION_TIME, Utils.Infinite_Time); UpdateResponse updateResponse = updateBlobMetadata(blobId, updateFields, cloudUpdateValidator); return Short.parseShort(updateResponse.metadata.getOrDefault(CloudBlobMetadata.FIELD_LIFE_VERSION, "0")); }
AzureCloudDestination implements CloudDestination { @Override public short undeleteBlob(BlobId blobId, short lifeVersion, CloudUpdateValidator cloudUpdateValidator) throws CloudStorageException { Map<String, Object> updateFields = new HashMap<>(); updateFields.put(CloudBlobMetadata.FIELD_LIFE_VERSION, lifeVersion); updateFields.put(CloudBlobMetadata.FIELD_DELETION_TIME, Utils.Infinite_Time); UpdateResponse updateResponse = updateBlobMetadata(blobId, updateFields, cloudUpdateValidator); return Short.parseShort(updateResponse.metadata.getOrDefault(CloudBlobMetadata.FIELD_LIFE_VERSION, "0")); } }
AzureCloudDestination implements CloudDestination { @Override public short undeleteBlob(BlobId blobId, short lifeVersion, CloudUpdateValidator cloudUpdateValidator) throws CloudStorageException { Map<String, Object> updateFields = new HashMap<>(); updateFields.put(CloudBlobMetadata.FIELD_LIFE_VERSION, lifeVersion); updateFields.put(CloudBlobMetadata.FIELD_DELETION_TIME, Utils.Infinite_Time); UpdateResponse updateResponse = updateBlobMetadata(blobId, updateFields, cloudUpdateValidator); return Short.parseShort(updateResponse.metadata.getOrDefault(CloudBlobMetadata.FIELD_LIFE_VERSION, "0")); } AzureCloudDestination(CloudConfig cloudConfig, AzureCloudConfig azureCloudConfig, String clusterName,
      VcrMetrics vcrMetrics, AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType);   AzureCloudDestination(BlobServiceClient storageClient, BlobBatchClient blobBatchClient,
      AsyncDocumentClient asyncDocumentClient, String cosmosCollectionLink, String clusterName,
      AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType, boolean isVcr); }
AzureCloudDestination implements CloudDestination { @Override public short undeleteBlob(BlobId blobId, short lifeVersion, CloudUpdateValidator cloudUpdateValidator) throws CloudStorageException { Map<String, Object> updateFields = new HashMap<>(); updateFields.put(CloudBlobMetadata.FIELD_LIFE_VERSION, lifeVersion); updateFields.put(CloudBlobMetadata.FIELD_DELETION_TIME, Utils.Infinite_Time); UpdateResponse updateResponse = updateBlobMetadata(blobId, updateFields, cloudUpdateValidator); return Short.parseShort(updateResponse.metadata.getOrDefault(CloudBlobMetadata.FIELD_LIFE_VERSION, "0")); } AzureCloudDestination(CloudConfig cloudConfig, AzureCloudConfig azureCloudConfig, String clusterName,
      VcrMetrics vcrMetrics, AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType);   AzureCloudDestination(BlobServiceClient storageClient, BlobBatchClient blobBatchClient,
      AsyncDocumentClient asyncDocumentClient, String cosmosCollectionLink, String clusterName,
      AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType, boolean isVcr); @Override boolean uploadBlob(BlobId blobId, long inputLength, CloudBlobMetadata cloudBlobMetadata,
      InputStream blobInputStream); @Override void downloadBlob(BlobId blobId, OutputStream outputStream); @Override boolean deleteBlob(BlobId blobId, long deletionTime, short lifeVersion,
      CloudUpdateValidator cloudUpdateValidator); @Override short updateBlobExpiration(BlobId blobId, long expirationTime, CloudUpdateValidator cloudUpdateValidator); @Override short undeleteBlob(BlobId blobId, short lifeVersion, CloudUpdateValidator cloudUpdateValidator); @Override Map<String, CloudBlobMetadata> getBlobMetadata(List<BlobId> blobIds); @Override void close(); @Override void stopCompaction(); @Override FindResult findEntriesSince(String partitionPath, FindToken findToken, long maxTotalSizeOfEntries); @Override int compactPartition(String partitionPath); @Override void persistTokens(String partitionPath, String tokenFileName, InputStream inputStream); @Override boolean retrieveTokens(String partitionPath, String tokenFileName, OutputStream outputStream); int getQueryBatchSize(); }
AzureCloudDestination implements CloudDestination { @Override public short undeleteBlob(BlobId blobId, short lifeVersion, CloudUpdateValidator cloudUpdateValidator) throws CloudStorageException { Map<String, Object> updateFields = new HashMap<>(); updateFields.put(CloudBlobMetadata.FIELD_LIFE_VERSION, lifeVersion); updateFields.put(CloudBlobMetadata.FIELD_DELETION_TIME, Utils.Infinite_Time); UpdateResponse updateResponse = updateBlobMetadata(blobId, updateFields, cloudUpdateValidator); return Short.parseShort(updateResponse.metadata.getOrDefault(CloudBlobMetadata.FIELD_LIFE_VERSION, "0")); } AzureCloudDestination(CloudConfig cloudConfig, AzureCloudConfig azureCloudConfig, String clusterName,
      VcrMetrics vcrMetrics, AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType);   AzureCloudDestination(BlobServiceClient storageClient, BlobBatchClient blobBatchClient,
      AsyncDocumentClient asyncDocumentClient, String cosmosCollectionLink, String clusterName,
      AzureMetrics azureMetrics, AzureReplicationFeed.FeedType azureReplicationFeedType, boolean isVcr); @Override boolean uploadBlob(BlobId blobId, long inputLength, CloudBlobMetadata cloudBlobMetadata,
      InputStream blobInputStream); @Override void downloadBlob(BlobId blobId, OutputStream outputStream); @Override boolean deleteBlob(BlobId blobId, long deletionTime, short lifeVersion,
      CloudUpdateValidator cloudUpdateValidator); @Override short updateBlobExpiration(BlobId blobId, long expirationTime, CloudUpdateValidator cloudUpdateValidator); @Override short undeleteBlob(BlobId blobId, short lifeVersion, CloudUpdateValidator cloudUpdateValidator); @Override Map<String, CloudBlobMetadata> getBlobMetadata(List<BlobId> blobIds); @Override void close(); @Override void stopCompaction(); @Override FindResult findEntriesSince(String partitionPath, FindToken findToken, long maxTotalSizeOfEntries); @Override int compactPartition(String partitionPath); @Override void persistTokens(String partitionPath, String tokenFileName, InputStream inputStream); @Override boolean retrieveTokens(String partitionPath, String tokenFileName, OutputStream outputStream); int getQueryBatchSize();  }