本文整理汇总了Java中com.microsoft.azure.storage.queue.CloudQueue.downloadAttributes方法的典型用法代码示例。如果您正苦于以下问题:Java CloudQueue.downloadAttributes方法的具体用法?Java CloudQueue.downloadAttributes怎么用?Java CloudQueue.downloadAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.microsoft.azure.storage.queue.CloudQueue
的用法示例。
在下文中一共展示了CloudQueue.downloadAttributes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testQueueDownloadAttributes
import com.microsoft.azure.storage.queue.CloudQueue; //导入方法依赖的package包/类
private static void testQueueDownloadAttributes(LocationMode optionsLocationMode, LocationMode clientLocationMode,
StorageLocation initialLocation, List<RetryContext> retryContextList, List<RetryInfo> retryInfoList)
throws URISyntaxException, StorageException {
CloudQueueClient client = TestHelper.createCloudQueueClient();
CloudQueue queue = client.getQueueReference(QueueTestHelper.generateRandomQueueName());
MultiLocationTestHelper helper = new MultiLocationTestHelper(queue.getServiceClient().getStorageUri(),
initialLocation, retryContextList, retryInfoList);
queue.getServiceClient().getDefaultRequestOptions().setLocationMode(clientLocationMode);
QueueRequestOptions options = new QueueRequestOptions();
options.setLocationMode(optionsLocationMode);
options.setRetryPolicyFactory(helper.retryPolicy);
try {
queue.downloadAttributes(options, helper.operationContext);
}
catch (StorageException ex) {
assertEquals(HttpURLConnection.HTTP_NOT_FOUND, ex.getHttpStatusCode());
}
finally {
helper.close();
}
}
示例2: testQueueMaximumExecutionTime
import com.microsoft.azure.storage.queue.CloudQueue; //导入方法依赖的package包/类
@Test
@Category({ DevFabricTests.class, DevStoreTests.class, SecondaryTests.class })
public void testQueueMaximumExecutionTime() throws URISyntaxException, StorageException {
OperationContext opContext = new OperationContext();
setDelay(opContext, 2500);
// set the maximum execution time
QueueRequestOptions options = new QueueRequestOptions();
options.setMaximumExecutionTimeInMs(2000);
// set the location mode to secondary, secondary request should fail
// so set the timeout low to save time failing (or fail with a timeout)
options.setLocationMode(LocationMode.SECONDARY_THEN_PRIMARY);
options.setTimeoutIntervalInMs(1000);
CloudQueueClient queueClient = TestHelper.createCloudQueueClient();
CloudQueue queue = queueClient.getQueueReference(generateRandomName("queue"));
try {
// 1. download attributes will fail as the queue does not exist
// 2. the executor will attempt to retry as it is accessing secondary
// 3. maximum execution time should prevent the retry from being made
queue.downloadAttributes(options, opContext);
fail("Maximum execution time was reached but request did not fail.");
}
catch (StorageException e) {
assertEquals(SR.MAXIMUM_EXECUTION_TIMEOUT_EXCEPTION, e.getMessage());
}
}