/** * Populates the default timeout and retry policy from client if they are not set. * * @param options * The input options to copy from when applying defaults * @param client * The {@link CloudQueueClient} service client to populate the * default values from. */ protected static final QueueRequestOptions populateAndApplyDefaults(QueueRequestOptions options, final CloudQueueClient client) { QueueRequestOptions modifiedOptions = new QueueRequestOptions(options); QueueRequestOptions.populateRequestOptions(modifiedOptions, client.getDefaultRequestOptions()); QueueRequestOptions.applyDefaults(modifiedOptions); return modifiedOptions; }
/** * Populates the default timeout and retry policy from client if they are not set. * * @param options * The input options to copy from when applying defaults * @param client * The {@link CloudQueueClient} service client to populate the * default values from. */ protected static final QueueRequestOptions populateAndApplyDefaults(QueueRequestOptions options, final CloudQueueClient client) { QueueRequestOptions modifiedOptions = new QueueRequestOptions(options); RequestOptions.populateRequestOptions(modifiedOptions, client.getDefaultRequestOptions(), true /* setStartTime */); QueueRequestOptions.applyDefaults(modifiedOptions); return modifiedOptions; }
@Category({ CloudTests.class }) @Test public void testGetServiceStats() throws StorageException { CloudQueueClient qClient = QueueTestHelper.createCloudQueueClient(); qClient.getDefaultRequestOptions().setLocationMode(LocationMode.SECONDARY_ONLY); TestHelper.verifyServiceStats(qClient.getServiceStats()); } }
queueClient.getDefaultRequestOptions().setLocationMode(LocationMode.PRIMARY_THEN_SECONDARY); queueClient.getDefaultRequestOptions().setTimeoutIntervalInMs(1000); queueClient.getDefaultRequestOptions().setRetryPolicyFactory(new RetryNoRetry());
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(); } }