/** * Deletes the share. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void delete() throws StorageException { this.delete(null /* accessCondition */, null /* options */, null /* opContext */); }
assertEquals(CloudFileShare.class, share.getClass()); shareList.remove(share.getName()); share.delete();
/** * Deletes the share. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void delete() throws StorageException { this.delete(DeleteShareSnapshotsOption.NONE, null /* accessCondition */, null /* options */, null /* opContext */); }
public void testCloudFileShareDeleteIfExistsErrorCode() throws StorageException { try { this.share.delete(); fail("Share should not already exist.");
/** * Deletes the 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. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void delete(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException { this.delete(DeleteShareSnapshotsOption.NONE, accessCondition, options, opContext); }
/** * Deletes the 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. * * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void delete(AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext) throws StorageException { this.delete(DeleteShareSnapshotsOption.NONE, accessCondition, options, opContext); }
if (exists) { try { this.delete(deleteSnapshotsOption, accessCondition, options, opContext); return true;
if (exists) { try { this.delete(deleteSnapshotsOption, accessCondition, options, opContext); return true;
@Override public void eventOccurred(SendingRequestEvent eventArg) { if (((HttpURLConnection) eventArg.getConnectionObject()).getRequestMethod().equals("DELETE")) { try { CloudFileShareTests.this.share.delete(); assertFalse(CloudFileShareTests.this.share.exists()); } catch (StorageException e) { fail("Delete should succeed."); } } } });
@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(); }
@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(snapshotRef5.exists()); snapshot.delete();
assertTrue(snapshotDir2.exists()); snapshot.delete();
snapshot.delete();
/** * Check a share's existence * * @throws StorageException */ @Test public void testCloudFileShareExists() throws StorageException { assertFalse(this.share.exists()); this.share.create(); assertTrue(this.share.exists()); assertNotNull(this.share.getProperties().getEtag()); this.share.delete(); assertFalse(this.share.exists()); }
snapshot.delete();
assertTrue(snapshotFile2.exists()); snapshot.delete();
assertNotNull(this.share.getProperties().getShareQuota()); assertEquals(shareQuota, this.share.getProperties().getShareQuota().intValue()); this.share.delete();
snapshot.delete();