/** * Lists the table names in the storage account in segmented mode. This method allows listing of tables to be * resumed after returning a partial set of results, using information returned by the server in the * {@link ResultSegment} object. * <p> * This method invokes the <a href="http://msdn.microsoft.com/en-us/library/azure/dd179405.aspx">Query Tables</a> * REST API to list the table names, using the Table service endpoint and storage account credentials of this * instance. * * @return * A {@link ResultSegment} of <code>String</code> objects containing table names in the storage account. * * @throws StorageException * if a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<String> listTablesSegmented() throws StorageException { return this.listTablesSegmented(null); }
/** * Lists the table names in the storage account in segmented mode. This method allows listing of tables to be * resumed after returning a partial set of results, using information returned by the server in the * {@link ResultSegment} object. * <p> * This method invokes the <a href="http://msdn.microsoft.com/en-us/library/azure/dd179405.aspx">Query Tables</a> * REST API to list the table names, using the Table service endpoint and storage account credentials of this * instance. * * @return * A {@link ResultSegment} of <code>String</code> objects containing table names in the storage account. * * @throws StorageException * if a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<String> listTablesSegmented() throws StorageException { return this.listTablesSegmented(null); }
/** * Lists the table names in the storage account that match the specified prefix in segmented mode. This method * allows listing of tables to be resumed after returning a partial set of results, using information returned by * the server in the {@link ResultSegment} object. * <p> * This method invokes the <a href="http://msdn.microsoft.com/en-us/library/azure/dd179405.aspx">Query Tables</a> * REST API to list the table names that match the prefix, using the Table service endpoint and storage account * credentials of this instance. * * @param prefix * A <code>String</code> containing the prefix to match on table names to return. * * @return * A {@link ResultSegment} of <code>String</code> objects containing table names matching the prefix in the * storage account. * * @throws StorageException * if a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<String> listTablesSegmented(final String prefix) throws StorageException { return this.listTablesSegmented(prefix, null /* maxResults */, null /* continuationToken */, null /* options */, null /* opContext */); }
/** * Lists the table names in the storage account that match the specified prefix in segmented mode. This method * allows listing of tables to be resumed after returning a partial set of results, using information returned by * the server in the {@link ResultSegment} object. * <p> * This method invokes the <a href="http://msdn.microsoft.com/en-us/library/azure/dd179405.aspx">Query Tables</a> * REST API to list the table names that match the prefix, using the Table service endpoint and storage account * credentials of this instance. * * @param prefix * A <code>String</code> containing the prefix to match on table names to return. * * @return * A {@link ResultSegment} of <code>String</code> objects containing table names matching the prefix in the * storage account. * * @throws StorageException * if a storage service error occurred during the operation. */ @DoesServiceRequest public ResultSegment<String> listTablesSegmented(final String prefix) throws StorageException { return this.listTablesSegmented(prefix, null /* maxResults */, null /* continuationToken */, null /* options */, null /* opContext */); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) public void testListTablesSegmentedMaxResultsValidation() throws URISyntaxException, StorageException { final CloudTableClient tClient = TableTestHelper.createCloudTableClient(); // Validation should cause each of these to fail. for (int i = 0; i >= -2; i--) { try { tClient.listTablesSegmented(null, i, null, null, null); fail(); } catch (IllegalArgumentException e) { assertTrue(String.format(SR.PARAMETER_SHOULD_BE_GREATER_OR_EQUAL, "maxResults", 1) .equals(e.getMessage())); } } assertNotNull(tClient.listTablesSegmented("thereshouldntbeanytableswiththisprefix")); }
ResultSegment<String> segment1 = tClient.listTablesSegmented(tableBaseName, 5, null, options, null); assertEquals(5, segment1.getLength()); for (String s : segment1.getResults()) { ResultSegment<String> segment2 = tClient.listTablesSegmented(tableBaseName, 5, segment1.getContinuationToken(), options, null); assertEquals(5, segment2.getLength()); ResultSegment<String> segment3 = tClient.listTablesSegmented(tableBaseName, 5, segment2.getContinuationToken(), options, null); assertEquals(5, segment3.getLength());
ResultSegment<String> segment1 = tClient.listTablesSegmented(null, 5, null, options, null); assertEquals(5, segment1.getLength()); for (String s : segment1.getResults()) { ResultSegment<String> segment2 = tClient.listTablesSegmented(null, 5, segment1.getContinuationToken(), options, null); assertEquals(5, segment2.getLength()); ResultSegment<String> segment3 = tClient.listTablesSegmented(null, 5, segment2.getContinuationToken(), options, null); assertEquals(5, segment3.getLength());