/** * Tests doing a listShares to ensure maxResults validation is working. * * @throws StorageException * @throws URISyntaxException */ @Test @Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) public void testListSharesMaxResultsValidationTest() throws StorageException, URISyntaxException { CloudFileClient fileClient = FileTestHelper.createCloudFileClient(); String prefix = UUID.randomUUID().toString(); // Validation should cause each of these to fail for (int i = 0; i >= -2; i--) { try{ fileClient.listSharesSegmented( prefix, EnumSet.allOf(ShareListingDetails.class), i, null, null, null); fail(); } catch (IllegalArgumentException e) { assertTrue(String.format(SR.PARAMETER_SHOULD_BE_GREATER_OR_EQUAL, "maxResults", 1) .equals(e.getMessage())); } } assertNotNull(fileClient.listSharesSegmented("thereshouldntbeanyshareswiththisprefix")); }
@Category({ DevFabricTests.class, DevStoreTests.class, CloudTests.class }) public void testListSharesTest() throws StorageException, URISyntaxException { CloudFileClient fileClient = FileTestHelper.createCloudFileClient(); ArrayList<String> shareList = new ArrayList<String>(); String prefix = UUID.randomUUID().toString();
public void testCloudFileShareSetPermissions() throws StorageException, InterruptedException, URISyntaxException { CloudFileClient client = FileTestHelper.createCloudFileClient(); this.share.create();
@Test public void testListSharesWithSnapshot() throws StorageException, URISyntaxException { CloudFileClient fileClient = FileTestHelper.createCloudFileClient(); CloudFileShare share = fileClient.getShareReference(UUID.randomUUID().toString()); try { share.uploadMetadata(); CloudFileClient client = FileTestHelper.createCloudFileClient(); Iterable<CloudFileShare> listResult = client.listShares(share.name, EnumSet.allOf(ShareListingDetails.class), null, null);
CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare snapshotRef = client.getShareReference(snapshot.name, snapshot.snapshotID); assertTrue(snapshotRef.exists());
@Test public void testUnsupportedApisShareSnapshot() throws StorageException, URISyntaxException { CloudFileClient client = FileTestHelper.createCloudFileClient(); this.share.create(); this.share.downloadPermissions();
@Test public void testDeleteShareSnapshotOptions() throws StorageException, URISyntaxException, IOException { // create share with metadata this.share.create(); assertTrue(this.share.exists()); // verify that exists() call on snapshot populates metadata CloudFileShare snapshot = this.share.createSnapshot(); CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare snapshotRef = client.getShareReference(snapshot.name, snapshot.snapshotID); assertTrue(snapshotRef.exists()); try { share.delete(); } catch (final StorageException e) { assertEquals(StorageErrorCodeStrings.SHARE_HAS_SNAPSHOTS, e.getErrorCode()); } share.delete(DeleteShareSnapshotsOption.INCLUDE_SNAPSHOTS, null, null, null); assertFalse(share.exists()); assertFalse(snapshot.exists()); }
/** * Validate share references * * @throws StorageException * @throws URISyntaxException */ @Test public void testCloudFileShareReference() throws StorageException, URISyntaxException { CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare share = client.getShareReference("share"); CloudFileDirectory directory = share.getRootDirectoryReference().getDirectoryReference("directory3"); CloudFileDirectory directory2 = directory.getDirectoryReference("directory4"); assertEquals(share.getStorageUri().toString(), directory.getShare().getStorageUri().toString()); assertEquals(share.getStorageUri().toString(), directory2.getShare().getStorageUri().toString()); assertEquals(share.getStorageUri().toString(), directory2.getParent().getShare().getStorageUri().toString()); }
CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare snapshotRef = client.getShareReference(snapshot.name, snapshot.snapshotID);
@Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudFileDeleteIfExistsErrorCode() throws URISyntaxException, StorageException, IOException { CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare share = client.getShareReference(FileTestHelper.generateRandomShareName()); share.create();