/** * Creates a snapshot of the share. * * @return A <code>CloudFileShare</code> object that represents the snapshot of the share. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public final CloudFileShare createSnapshot() throws StorageException { return this .createSnapshot(null /* metadata */, null /* accessCondition */, null /* options */, null /* opContext */); }
/** * Creates a snapshot of the share. * * @return A <code>CloudFileShare</code> object that represents the snapshot of the share. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public final CloudFileShare createSnapshot() throws StorageException { return this .createSnapshot(null /* metadata */, null /* accessCondition */, null /* options */, null /* opContext */); }
/** * Creates a snapshot of the file share using the specified request options and operation context. * * @param accessCondition * An {@link AccessCondition} object that represents the access conditions for the share. * @param options * A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudFileClient}). * @param opContext * An {@link OperationContext} object that represents the context for the current operation. This object * is used to track requests to the storage service, and to provide additional runtime information about * the operation. * * @return A <code>CloudFileShare</code> object that represents the snapshot of the file share. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public final CloudFileShare createSnapshot(final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException { return this.createSnapshot(null /* metadata */, accessCondition, options, opContext); }
/** * Creates a snapshot of the file share using the specified request options and operation context. * * @param accessCondition * An {@link AccessCondition} object that represents the access conditions for the share. * @param options * A {@link FileRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudFileClient}). * @param opContext * An {@link OperationContext} object that represents the context for the current operation. This object * is used to track requests to the storage service, and to provide additional runtime information about * the operation. * * @return A <code>CloudFileShare</code> object that represents the snapshot of the file share. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public final CloudFileShare createSnapshot(final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException { return this.createSnapshot(null /* metadata */, accessCondition, options, opContext); }
@Test public void testUnsupportedDirectoryApisWithinShareSnapshot() throws StorageException, URISyntaxException { CloudFileShare snapshot = this.share.createSnapshot(); CloudFileDirectory rootDir = snapshot.getRootDirectoryReference(); try { rootDir.create(); fail("Shouldn't get here"); } catch (IllegalArgumentException e) { assertEquals(SR.INVALID_OPERATION_FOR_A_SHARE_SNAPSHOT, e.getMessage()); } try { rootDir.delete(); fail("Shouldn't get here"); } catch (IllegalArgumentException e) { assertEquals(SR.INVALID_OPERATION_FOR_A_SHARE_SNAPSHOT, e.getMessage()); } try { rootDir.uploadMetadata(); fail("Shouldn't get here"); } catch (IllegalArgumentException e) { assertEquals(SR.INVALID_OPERATION_FOR_A_SHARE_SNAPSHOT, e.getMessage()); } snapshot.delete(); }
this.share.create(); this.share.downloadPermissions(); CloudFileShare snapshot = this.share.createSnapshot(); try { snapshot.createSnapshot(); fail("Shouldn't get here");
CloudFileShare snapshot = this.share.createSnapshot(); CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare snapshotRef = client.getShareReference(snapshot.name, snapshot.snapshotID); CloudFileShare snapshotRef3 = this.share.createSnapshot(shareMeta2, null, null, null); CloudFileShare snapshotRef4 = client.getShareReference(snapshotRef3.name, snapshotRef3.snapshotID); assertTrue(snapshotRef4.exists());
share.uploadMetadata(); CloudFileShare snapshot = share.createSnapshot(); HashMap<String, String> meta2 = new HashMap<String, String>(); meta2.put("key2", "value2");
dir.setMetadata(meta); dir.uploadMetadata(); CloudFileShare snapshot = this.share.createSnapshot(); CloudFileDirectory snapshotDir = snapshot.getRootDirectoryReference().getDirectoryReference("dir1");
@Test public void testUnsupportedFileApisWithinShareSnapshot() throws StorageException, URISyntaxException { CloudFileShare snapshot = this.share.createSnapshot(); CloudFile file = snapshot.getRootDirectoryReference().getFileReference("file");
file.uploadMetadata(); CloudFileShare snapshot = this.share.createSnapshot(); CloudFile snapshotFile = snapshot.getRootDirectoryReference() .getDirectoryReference("dir1").getFileReference("file");
@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()); }
assertTrue(this.share.exists()); CloudFileShare snapshot = this.share.createSnapshot(); CloudFileClient client = FileTestHelper.createCloudFileClient(); CloudFileShare snapshotRef = client.getShareReference(snapshot.name, snapshot.snapshotID);