/** * Returns an enumerable collection of log blobs, retrieved lazily. * * @param service * A {@link StorageService} enumeration value that indicates which storage service to use. * @return * An enumerable collection of objects that implement <code>ListBlobItem</code> and are retrieved lazily. * @throws URISyntaxException * @throws StorageException */ public Iterable<ListBlobItem> listLogBlobs(StorageService service) throws URISyntaxException, StorageException { return this.listLogBlobs(service, null /* startTime */, null /* endTime */, null /* operations */, null /* details */, null /* options */, null /* operationContext */); }
/** * Returns an enumerable collection of log blobs, retrieved lazily. * * @param service * A {@link StorageService} enumeration value that indicates which storage service to use. * @return * An enumerable collection of objects that implement <code>ListBlobItem</code> and are retrieved lazily. * @throws URISyntaxException * @throws StorageException */ public Iterable<ListBlobItem> listLogBlobs(StorageService service) throws URISyntaxException, StorageException { return this.listLogBlobs(service, null /* startTime */, null /* endTime */, null /* operations */, null /* details */, null /* options */, null /* operationContext */); }
/** * List Logs with well defined time range * * @throws URISyntaxException * @throws StorageException * @throws IOException * @throws InterruptedException */ @Test public void testCloudAnalyticsClientListLogsStartEndTime() throws URISyntaxException, StorageException, IOException { this.container.create(); this.client.LogContainer = this.container.getName(); int numBlobs = 72; Calendar now = new GregorianCalendar(); now.add(GregorianCalendar.DAY_OF_MONTH, -3); List<String> blobNames = AnalyticsTestHelper.CreateLogs(this.container, StorageService.BLOB, 72, now, Granularity.HOUR); assertEquals(numBlobs, blobNames.size()); Calendar start = new GregorianCalendar(); start.add(GregorianCalendar.DAY_OF_MONTH, -2); Calendar end = new GregorianCalendar(); end.add(GregorianCalendar.DAY_OF_MONTH, -1); for (ListBlobItem blob : this.client.listLogBlobs(StorageService.BLOB, start.getTime(), end.getTime(), null, null, null, null)) { assertEquals(CloudBlockBlob.class, blob.getClass()); assertTrue(blobNames.remove(((CloudBlockBlob) blob).getName())); } assertTrue(blobNames.size() == 48); }
/** * List Logs with open ended time range * * @throws URISyntaxException * @throws StorageException * @throws IOException * @throws InterruptedException */ @Test public void testCloudAnalyticsClientListLogsStartTime() throws URISyntaxException, StorageException, IOException { this.container.create(); this.client.LogContainer = this.container.getName(); int numBlobs = 48; Calendar now = new GregorianCalendar(); now.add(GregorianCalendar.DAY_OF_MONTH, -2); List<String> blobNames = AnalyticsTestHelper.CreateLogs(this.container, StorageService.BLOB, 48, now, Granularity.HOUR); assertEquals(numBlobs, blobNames.size()); Calendar start = new GregorianCalendar(); start.add(GregorianCalendar.DAY_OF_MONTH, -1); for (ListBlobItem blob : this.client.listLogBlobs(StorageService.BLOB, start.getTime(), null, null, null, null, null)) { assertEquals(CloudBlockBlob.class, blob.getClass()); assertTrue(blobNames.remove(((CloudBlockBlob) blob).getName())); } assertTrue(blobNames.size() == 24); }
/** * List all logs * * @throws URISyntaxException * @throws StorageException * @throws IOException * @throws InterruptedException */ public void testCloudAnalyticsClientListLogs() throws URISyntaxException, StorageException, IOException { this.container.create(); this.client.LogContainer = this.container.getName(); int numBlobs = 13; Calendar now = new GregorianCalendar(); now.add(GregorianCalendar.MONTH, -13); List<String> blobNames = AnalyticsTestHelper.CreateLogs(this.container, StorageService.BLOB, 13, now, Granularity.MONTH); assertEquals(numBlobs, blobNames.size()); for (ListBlobItem blob : this.client.listLogBlobs(StorageService.BLOB)) { assertEquals(CloudBlockBlob.class, blob.getClass()); assertTrue(blobNames.remove(((CloudBlockBlob) blob).getName())); } assertTrue(blobNames.size() == 0); }