/** * Gets a result segment of an iterable collection of queues for this Queue * service client. * * @return A {@link ResultSegment} of {@link CloudQueue} objects that * contains a segment of the iterable collection of {@link CloudQueue} objects that represent the requested * queues in * the storage service. * * @throws StorageException * If a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<CloudQueue> listQueuesSegmented() throws StorageException { return this.listQueuesSegmented(null, QueueListingDetails.NONE, null, null, null, null); }
/** * Gets a result segment of an iterable collection of queues for this Queue * service client. * * @return A {@link ResultSegment} of {@link CloudQueue} objects that * contains a segment of the iterable collection of {@link CloudQueue} objects that represent the requested * queues in * the storage service. * * @throws StorageException * If a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<CloudQueue> listQueuesSegmented() throws StorageException { return this.listQueuesSegmented(null, QueueListingDetails.NONE, null, null, null, null); }
/** * Gets a result segment of an iterable collection of queues whose names * begin with the specified prefix for this Queue service client. * * @return A {@link ResultSegment} of {@link CloudQueue} objects that * contains a segment of the iterable collection of {@link CloudQueue} objects that represent the requested * queues in * the storage service. * * @throws StorageException * If a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<CloudQueue> listQueuesSegmented(final String prefix) throws StorageException { return this.listQueuesSegmented(prefix, QueueListingDetails.NONE, null, null, null, null); }
/** * Gets a result segment of an iterable collection of queues whose names * begin with the specified prefix for this Queue service client. * * @return A {@link ResultSegment} of {@link CloudQueue} objects that * contains a segment of the iterable collection of {@link CloudQueue} objects that represent the requested * queues in * the storage service. * * @throws StorageException * If a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<CloudQueue> listQueuesSegmented(final String prefix) throws StorageException { return this.listQueuesSegmented(prefix, QueueListingDetails.NONE, null, null, null, null); }
@Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) @Test public void testListQueuesSegmentedMaxResultsValidation() throws URISyntaxException, StorageException { CloudQueueClient qClient = QueueTestHelper.createCloudQueueClient(); // Validation should cause each of these to fail for (int i = 0; i >= -2; i--) { try { qClient.listQueuesSegmented(null, QueueListingDetails.NONE, i, null, null, null); fail(); } catch (IllegalArgumentException e) { assertTrue(String.format(SR.PARAMETER_SHOULD_BE_GREATER_OR_EQUAL, "maxResults", 1) .equals(e.getMessage())); } } assertNotNull(qClient.listQueuesSegmented("thereshouldntbeanyqueueswiththisprefix")); }
@Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) @Test public void testListQueuesSegmented() throws URISyntaxException, StorageException { CloudQueueClient qClient = QueueTestHelper.createCloudQueueClient(); String prefix = "segment" + UUID.randomUUID().toString().substring(0, 8).toLowerCase(); HashMap<String, String> metadata1 = new HashMap<String, String>(); metadata1.put("ExistingMetadata1", "ExistingMetadataValue1"); for (int i = 0; i < 35; i++) { CloudQueue q = qClient.getQueueReference(prefix + UUID.randomUUID().toString().toLowerCase()); q.setMetadata(metadata1); q.create(); } ResultSegment<CloudQueue> segment1 = qClient.listQueuesSegmented(prefix); assertTrue(segment1.getLength() == 35); ResultSegment<CloudQueue> segment2 = qClient.listQueuesSegmented(prefix, QueueListingDetails.NONE, 5, null, null, null); assertTrue(segment2.getLength() == 5); int totalRoundTrip = 1; while (segment2.getHasMoreResults()) { segment2 = qClient.listQueuesSegmented(prefix, QueueListingDetails.NONE, 5, segment2.getContinuationToken(), null, null); assertTrue(segment2.getLength() == 5); totalRoundTrip++; } assertTrue(totalRoundTrip == 7); ResultSegment<CloudQueue> segment3 = qClient.listQueuesSegmented(prefix, QueueListingDetails.NONE, null, null, null, null); assertTrue(segment3.getLength() == 35); }
@Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) @Test public void testListQueuesAndListQueuesSegmentedLargeNumber() throws URISyntaxException, StorageException { CloudQueueClient qClient = QueueTestHelper.createCloudQueueClient(); int count = 0; String prefix = UUID.randomUUID().toString(); for (CloudQueue queue : qClient.listQueues(prefix)) { assertNotNull(queue); count++; } int totalLimit = 505; if (count < totalLimit) { NumberFormat myFormat = NumberFormat.getInstance(); myFormat.setMinimumIntegerDigits(4); for (int i = 0; i < totalLimit - count; i++) { CloudQueue q = qClient.getQueueReference(prefix + i); q.createIfNotExists(); } } ResultSegment<CloudQueue> segment = qClient.listQueuesSegmented(prefix, QueueListingDetails.NONE, 500, null, null, null); assertTrue(segment.getLength() == 500); assertTrue(segment.getContinuationToken() != null); }