Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 4849bab

Browse files
author
Josh Friedman
committed
Uncommenting tests for share snapshots
1 parent e3ec15c commit 4849bab

File tree

6 files changed

+23
-30
lines changed

6 files changed

+23
-30
lines changed

microsoft-azure-storage-test/src/com/microsoft/azure/storage/file/CloudFileClientTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void testListSharesMaxResultsValidationTest() throws StorageException, UR
115115
assertNotNull(fileClient.listSharesSegmented("thereshouldntbeanyshareswiththisprefix"));
116116
}
117117

118-
//@Test
118+
@Test
119119
public void testListSharesWithSnapshot() throws StorageException, URISyntaxException {
120120
CloudFileClient fileClient = FileTestHelper.createCloudFileClient();
121121
CloudFileShare share = fileClient.getShareReference(UUID.randomUUID().toString());

microsoft-azure-storage-test/src/com/microsoft/azure/storage/file/CloudFileDirectoryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ private static void testMetadataFailures(CloudFileDirectory directory, String ke
480480
directory.getMetadata().remove(key);
481481
}
482482

483-
//@Test
483+
@Test
484484
public void testUnsupportedDirectoryApisWithinShareSnapshot() throws StorageException, URISyntaxException {
485485
CloudFileShare snapshot = this.share.createSnapshot();
486486
CloudFileDirectory rootDir = snapshot.getRootDirectoryReference();
@@ -509,7 +509,7 @@ public void testUnsupportedDirectoryApisWithinShareSnapshot() throws StorageExce
509509
snapshot.delete();
510510
}
511511

512-
//@Test
512+
@Test
513513
public void testSupportedDirectoryApisInShareSnapshot() throws StorageException, URISyntaxException {
514514
CloudFileDirectory dir = this.share.getRootDirectoryReference().getDirectoryReference("dir1");
515515
dir.deleteIfExists();

microsoft-azure-storage-test/src/com/microsoft/azure/storage/file/CloudFileShareTests.java

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ public void eventOccurred(SendingRequestEvent eventArg) {
494494
assertTrue(this.share.deleteIfExists(null, null, ctx));
495495
}
496496

497-
//@Test
497+
@Test
498498
public void testCreateShareSnapshot() throws StorageException, URISyntaxException, IOException {
499499
// create share with metadata
500500
this.share.create();
@@ -551,15 +551,15 @@ public void testCreateShareSnapshot() throws StorageException, URISyntaxExceptio
551551

552552
final UriQueryBuilder uriBuilder = new UriQueryBuilder();
553553
uriBuilder.add("sharesnapshot", snapshot.snapshotID);
554-
// CloudFileShare snapshotRef5 = new CloudFileShare(uriBuilder.addToURI(this.share.getUri()),
555-
// this.share.getServiceClient().getCredentials(), null);
556-
// assertEquals(snapshot.snapshotID, snapshotRef5.snapshotID);
557-
// assertTrue(snapshotRef5.exists());
554+
CloudFileShare snapshotRef5 = new CloudFileShare(uriBuilder.addToURI(this.share.getUri()),
555+
this.share.getServiceClient().getCredentials());
556+
assertEquals(snapshot.snapshotID, snapshotRef5.snapshotID);
557+
assertTrue(snapshotRef5.exists());
558558

559559
snapshot.delete();
560560
}
561561

562-
//@Test
562+
@Test
563563
public void testDeleteShareSnapshotOptions() throws StorageException, URISyntaxException, IOException {
564564
// create share with metadata
565565
this.share.create();
@@ -583,7 +583,7 @@ public void testDeleteShareSnapshotOptions() throws StorageException, URISyntaxE
583583
assertFalse(snapshot.exists());
584584
}
585585

586-
//@Test
586+
@Test
587587
public void testListFilesAndDirectoriesWithinShareSnapshot() throws StorageException, URISyntaxException {
588588
this.share.create();
589589

@@ -624,7 +624,7 @@ public void testListFilesAndDirectoriesWithinShareSnapshot() throws StorageExcep
624624
snapshot.delete();
625625
}
626626

627-
//@Test
627+
@Test
628628
public void testUnsupportedApisShareSnapshot() throws StorageException, URISyntaxException {
629629
CloudFileClient client = FileTestHelper.createCloudFileClient();
630630
this.share.create();
@@ -637,13 +637,6 @@ public void testUnsupportedApisShareSnapshot() throws StorageException, URISynta
637637
catch (IllegalArgumentException e) {
638638
assertEquals(SR.INVALID_OPERATION_FOR_A_SHARE_SNAPSHOT, e.getMessage());
639639
}
640-
// try {
641-
// new CloudFileShare(snapshot.getQualifiedUri(), client.getCredentials(), "2016-10-24T16:37:17.0000000Z");
642-
// fail("Shouldn't get here");
643-
// }
644-
// catch (IllegalArgumentException e) {
645-
// assertEquals(SR.SNAPSHOT_QUERY_OPTION_ALREADY_DEFINED, e.getMessage());
646-
// }
647640
try {
648641
snapshot.downloadPermissions();
649642
fail("Shouldn't get here");

microsoft-azure-storage-test/src/com/microsoft/azure/storage/file/CloudFileTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,7 +1617,7 @@ private void doCloudFileCopy(boolean sourceIsSas, boolean destinationIsSas)
16171617
source.delete();
16181618
}
16191619

1620-
//@Test
1620+
@Test
16211621
public void testUnsupportedFileApisWithinShareSnapshot() throws StorageException, URISyntaxException {
16221622
CloudFileShare snapshot = this.share.createSnapshot();
16231623
CloudFile file = snapshot.getRootDirectoryReference().getFileReference("file");
@@ -1677,7 +1677,7 @@ public void testUnsupportedFileApisWithinShareSnapshot() throws StorageException
16771677
snapshot.delete();
16781678
}
16791679

1680-
//@Test
1680+
@Test
16811681
public void testSupportedFileApisInShareSnapshot() throws StorageException, URISyntaxException, UnsupportedEncodingException {
16821682
CloudFileDirectory dir = this.share.getRootDirectoryReference().getDirectoryReference("dir1");
16831683
dir.deleteIfExists();

microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public CloudFileShare getShareReference(final String shareName) throws URISyntax
121121
* @see <a href="http://msdn.microsoft.com/en-us/library/azure/dn167011.aspx">Naming and Referencing Shares,
122122
* Directories, Files, and Metadata</a>
123123
*/
124-
protected CloudFileShare getShareReference(final String shareName, String snapshotID) throws URISyntaxException, StorageException {
124+
public CloudFileShare getShareReference(final String shareName, String snapshotID) throws URISyntaxException, StorageException {
125125
Utility.assertNotNullOrEmpty("shareName", shareName);
126126
return new CloudFileShare(shareName, snapshotID, this);
127127
}

microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileShare.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public final class CloudFileShare {
111111
* @see <a href="http://msdn.microsoft.com/en-us/library/azure/dn167011.aspx">Naming and Referencing Shares,
112112
* Directories, Files, and Metadata</a>
113113
*/
114-
protected CloudFileShare(final String shareName, String snapshotID, final CloudFileClient client) throws URISyntaxException,
114+
public CloudFileShare(final String shareName, String snapshotID, final CloudFileClient client) throws URISyntaxException,
115115
StorageException {
116116
Utility.assertNotNull("client", client);
117117
Utility.assertNotNull("shareName", shareName);
@@ -395,7 +395,7 @@ public void delete(AccessCondition accessCondition, FileRequestOptions options,
395395
* If a storage service error occurred.
396396
*/
397397
@DoesServiceRequest
398-
protected void delete(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext)
398+
public void delete(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext)
399399
throws StorageException {
400400
if (opContext == null) {
401401
opContext = new OperationContext();
@@ -508,7 +508,7 @@ public boolean deleteIfExists(AccessCondition accessCondition, FileRequestOption
508508
* If a storage service error occurred.
509509
*/
510510
@DoesServiceRequest
511-
protected boolean deleteIfExists(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options,
511+
public boolean deleteIfExists(DeleteShareSnapshotsOption deleteSnapshotsOption, AccessCondition accessCondition, FileRequestOptions options,
512512
OperationContext opContext) throws StorageException {
513513
options = FileRequestOptions.populateAndApplyDefaults(options, this.fileServiceClient);
514514

@@ -728,7 +728,7 @@ public FileSharePermissions postProcessResponse(HttpURLConnection connection,
728728
* If a storage service error occurred.
729729
*/
730730
@DoesServiceRequest
731-
protected final CloudFileShare createSnapshot() throws StorageException {
731+
public final CloudFileShare createSnapshot() throws StorageException {
732732
return this
733733
.createSnapshot(null /* metadata */, null /* accessCondition */, null /* options */, null /* opContext */);
734734
}
@@ -753,7 +753,7 @@ protected final CloudFileShare createSnapshot() throws StorageException {
753753
* If a storage service error occurred.
754754
*/
755755
@DoesServiceRequest
756-
protected final CloudFileShare createSnapshot(final AccessCondition accessCondition, FileRequestOptions options,
756+
public final CloudFileShare createSnapshot(final AccessCondition accessCondition, FileRequestOptions options,
757757
OperationContext opContext) throws StorageException {
758758
return this.createSnapshot(null /* metadata */, accessCondition, options, opContext);
759759
}
@@ -780,7 +780,7 @@ protected final CloudFileShare createSnapshot(final AccessCondition accessCondit
780780
* If a storage service error occurred.
781781
*/
782782
@DoesServiceRequest
783-
protected final CloudFileShare createSnapshot(final HashMap<String, String> metadata,
783+
public final CloudFileShare createSnapshot(final HashMap<String, String> metadata,
784784
final AccessCondition accessCondition, FileRequestOptions options, OperationContext opContext)
785785
throws StorageException {
786786
assertNoSnapshot();
@@ -1502,7 +1502,7 @@ public URI getUri() {
15021502
*
15031503
* @return The snapshotID as a string for this share.
15041504
*/
1505-
protected final String getSnapshot() {
1505+
public final String getSnapshot() {
15061506
return this.snapshotID;
15071507
}
15081508

@@ -1513,7 +1513,7 @@ protected final String getSnapshot() {
15131513
*
15141514
* @see DeleteSnapshotsOption
15151515
*/
1516-
protected final boolean isSnapshot() {
1516+
public final boolean isSnapshot() {
15171517
return this.snapshotID != null;
15181518
}
15191519

@@ -1591,7 +1591,7 @@ public void setMetadata(final HashMap<String, String> metadata) {
15911591
* A {@link FileShareProperties} object that represents the properties being assigned to the
15921592
* share.
15931593
*/
1594-
protected void setProperties(final FileShareProperties properties) {
1594+
public void setProperties(final FileShareProperties properties) {
15951595
this.properties = properties;
15961596
}
15971597

0 commit comments

Comments
 (0)