@Test public void testGetDeadBlobs() throws Exception { Observable<FeedResponse<Document>> mockResponse = getMockedObservableForQueryWithNoResults(); when(mockumentClient.queryDocuments(anyString(), any(SqlQuerySpec.class), any(FeedOptions.class))).thenReturn( mockResponse); long now = System.currentTimeMillis(); List<CloudBlobMetadata> metadataList = azureStorageCompactor.getDeadBlobs(partitionPath, CloudBlobMetadata.FIELD_DELETION_TIME, 1, now, 10); assertEquals("Expected no deleted blobs", 0, metadataList.size()); assertEquals(1, azureMetrics.documentQueryCount.getCount()); assertEquals(1, azureMetrics.deadBlobsQueryTime.getCount()); metadataList = azureStorageCompactor.getDeadBlobs(partitionPath, CloudBlobMetadata.FIELD_EXPIRATION_TIME, 1, now, 10); assertEquals("Expected no expired blobs", 0, metadataList.size()); assertEquals(2, azureMetrics.documentQueryCount.getCount()); assertEquals(2, azureMetrics.deadBlobsQueryTime.getCount()); }
List<CloudBlobMetadata> getDeadBlobs(String partitionPath, String fieldName, long startTime, long endTime, int maxEntries) throws CloudStorageException { try { return cosmosDataAccessor.getDeadBlobs(partitionPath, fieldName, startTime, endTime, maxEntries); } catch (DocumentClientException dex) { throw AzureCloudDestination.toCloudStorageException( "Failed to query deleted blobs for partition " + partitionPath, dex, azureMetrics); } }
AzureStorageCompactor { List<CloudBlobMetadata> getDeadBlobs(String partitionPath, String fieldName, long startTime, long endTime, int maxEntries) throws CloudStorageException { try { return cosmosDataAccessor.getDeadBlobs(partitionPath, fieldName, startTime, endTime, maxEntries); } catch (DocumentClientException dex) { throw AzureCloudDestination.toCloudStorageException( "Failed to query deleted blobs for partition " + partitionPath, dex, azureMetrics); } } }
AzureStorageCompactor { List<CloudBlobMetadata> getDeadBlobs(String partitionPath, String fieldName, long startTime, long endTime, int maxEntries) throws CloudStorageException { try { return cosmosDataAccessor.getDeadBlobs(partitionPath, fieldName, startTime, endTime, maxEntries); } catch (DocumentClientException dex) { throw AzureCloudDestination.toCloudStorageException( "Failed to query deleted blobs for partition " + partitionPath, dex, azureMetrics); } } AzureStorageCompactor(AzureBlobDataAccessor azureBlobDataAccessor, CosmosDataAccessor cosmosDataAccessor,
      CloudConfig cloudConfig, VcrMetrics vcrMetrics, AzureMetrics azureMetrics); }
AzureStorageCompactor { List<CloudBlobMetadata> getDeadBlobs(String partitionPath, String fieldName, long startTime, long endTime, int maxEntries) throws CloudStorageException { try { return cosmosDataAccessor.getDeadBlobs(partitionPath, fieldName, startTime, endTime, maxEntries); } catch (DocumentClientException dex) { throw AzureCloudDestination.toCloudStorageException( "Failed to query deleted blobs for partition " + partitionPath, dex, azureMetrics); } } AzureStorageCompactor(AzureBlobDataAccessor azureBlobDataAccessor, CosmosDataAccessor cosmosDataAccessor,
      CloudConfig cloudConfig, VcrMetrics vcrMetrics, AzureMetrics azureMetrics); void shutdown(); int compactPartition(String partitionPath); }
AzureStorageCompactor { List<CloudBlobMetadata> getDeadBlobs(String partitionPath, String fieldName, long startTime, long endTime, int maxEntries) throws CloudStorageException { try { return cosmosDataAccessor.getDeadBlobs(partitionPath, fieldName, startTime, endTime, maxEntries); } catch (DocumentClientException dex) { throw AzureCloudDestination.toCloudStorageException( "Failed to query deleted blobs for partition " + partitionPath, dex, azureMetrics); } } AzureStorageCompactor(AzureBlobDataAccessor azureBlobDataAccessor, CosmosDataAccessor cosmosDataAccessor,
      CloudConfig cloudConfig, VcrMetrics vcrMetrics, AzureMetrics azureMetrics); void shutdown(); int compactPartition(String partitionPath);  }