/** * Downloads the share's attributes, which consist of metadata and properties. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void downloadAttributes() throws StorageException { this.downloadAttributes(null /* accessCondition */, null /* options */, null /* opContext */); }
/** * Downloads the share's attributes, which consist of metadata and properties. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void downloadAttributes() throws StorageException { this.downloadAttributes(null /* accessCondition */, null /* options */, null /* opContext */); }
share.downloadAttributes(); assertEquals(CloudFileShare.class, share.getClass()); shareList.remove(share.getName());
share2.downloadAttributes(); assertEquals(1, share2.getMetadata().size()); assertEquals("value1", share2.getMetadata().get("key1")); assertEquals("value2", this.share.getMetadata().get("key2")); share2.downloadAttributes(); assertEquals(2, this.share.getMetadata().size()); assertEquals("value1", this.share.getMetadata().get("key1")); this.share.uploadMetadata(); share2.downloadAttributes(); assertEquals(0, share2.getMetadata().size());
snapshotRef2.downloadAttributes(); snapshot.downloadAttributes(); assertTrue(snapshotRef2.getMetadata().size() == 1 && snapshotRef2.getMetadata().get("key1").equals("value1")); assertTrue(snapshot.getMetadata().size() == 1 && snapshot.getMetadata().get("key1").equals("value1"));
this.share.downloadAttributes(); assertNotNull(this.share.getProperties().getShareQuota()); int shareQuota = FileConstants.MAX_SHARE_QUOTA; this.share.getProperties().setShareQuota(shareQuota); this.share.uploadProperties(); this.share.downloadAttributes(); assertNotNull(this.share.getProperties().getShareQuota()); assertEquals(shareQuota, this.share.getProperties().getShareQuota().intValue()); assertNotNull(this.share.getProperties().getShareQuota()); assertEquals(shareQuota, this.share.getProperties().getShareQuota().intValue()); this.share.downloadAttributes(); assertNotNull(this.share.getProperties().getShareQuota()); assertEquals(shareQuota, this.share.getProperties().getShareQuota().intValue());
@Test @Category({ DevFabricTests.class, DevStoreTests.class, SecondaryTests.class }) public void testFileMaximumExecutionTime() throws URISyntaxException, StorageException { OperationContext opContext = new OperationContext(); setDelay(opContext, 2500); opContext.getResponseReceivedEventHandler().addListener(new StorageEvent<ResponseReceivedEvent>() { @Override public void eventOccurred(ResponseReceivedEvent eventArg) { // Set status code to 500 to force a retry eventArg.getRequestResult().setStatusCode(500); } }); // set the maximum execution time FileRequestOptions options = new FileRequestOptions(); options.setMaximumExecutionTimeInMs(2000); options.setTimeoutIntervalInMs(1000); CloudFileClient fileClient = TestHelper.createCloudFileClient(); CloudFileShare share = fileClient.getShareReference(generateRandomName("share")); try { // 1. download attributes will fail as the share does not exist // 2. the executor will attempt to retry as we set the status code to 500 // 3. maximum execution time should prevent the retry from being made share.downloadAttributes(null, options, opContext); fail("Maximum execution time was reached but request did not fail."); } catch (StorageException e) { assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getMessage()); } }