Skip to content

Commit

Permalink
Merge pull request Azure#66 from jofriedm-msft/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
pemari-msft authored May 23, 2017
2 parents f31f31d + 25b7fef commit 42a2846
Show file tree
Hide file tree
Showing 17 changed files with 739 additions and 797 deletions.
9 changes: 9 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
2017.05.23 Version 5.2.0
* Fixed Exists() calls on Shares and Directories to now populate metadata. This was already being done for Files.
* Changed blob constants to support up to 256 MB on put blob for block blobs. The default value for put blob threshold has also been updated to half of the maximum, or 128 MB currently.
* Fixed a bug that prevented setting content MD5 to true when creating a new file.
* Fixed a bug where access conditions, options, and operation context were not being passed when calling openWriteExisting() on a page blob or a file.
* Fixed a bug where an exception was being thrown on a range get of a blob or file when the options disableContentMD5Validation is set to false and useTransactionalContentMD5 is set to true and there is no overall MD5.
* Fixed a bug where retries were happening immediately if a socket exception was thrown.
* In CloudFileShareProperties, setShareQuota() no longer asserts in bounds. This check has been moved to create() and uploadProperties() in CloudFileShare.

2017.05.14 Version 5.1.1
* Reverted version 5.1.0 due to a regression which was caught after publishing. Version 5.2.0 will be released that contains the fixes from 5.1.0 without the regression.

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>5.1.1</version>
<version>5.2.0</version>
</dependency>
```

Expand Down
2 changes: 1 addition & 1 deletion microsoft-azure-storage-samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>5.1.1</version>
<version>5.2.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ public void testMaximumExecutionTimeBlobWrites() throws URISyntaxException, Stor
BlobRequestOptions options = new BlobRequestOptions();
options.setMaximumExecutionTimeInMs(5000);

// set a lower put blob threshold so that we perform multiple put block requests that timeout
options.setSingleBlobPutThresholdInBytes(32 * Constants.MB);

CloudBlobClient blobClient = TestHelper.createCloudBlobClient();
CloudBlobContainer container = blobClient.getContainerReference(generateRandomName("container"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,46 +115,46 @@ public void testListSharesMaxResultsValidationTest() throws StorageException, UR
assertNotNull(fileClient.listSharesSegmented("thereshouldntbeanyshareswiththisprefix"));
}

//@Test
public void testListSharesWithSnapshot() throws StorageException, URISyntaxException {
CloudFileClient fileClient = FileTestHelper.createCloudFileClient();
CloudFileShare share = fileClient.getShareReference(UUID.randomUUID().toString());
share.create();

HashMap<String, String> shareMeta = new HashMap<String, String>();
shareMeta.put("key1", "value1");
share.setMetadata(shareMeta);
share.uploadMetadata();

CloudFileShare snapshot = share.createSnapshot();
HashMap<String, String> meta2 = new HashMap<String, String>();
meta2.put("key2", "value2");
share.setMetadata(meta2);
share.uploadMetadata();

CloudFileClient client = FileTestHelper.createCloudFileClient();
Iterable<CloudFileShare> listResult = client.listShares(share.name, ShareListingDetails.ALL, null, null);

int count = 0;
boolean originalFound = false;
boolean snapshotFound = false;
for (CloudFileShare listShareItem : listResult) {
if (listShareItem.getName().equals(share.getName()) && !listShareItem.isSnapshot() && !originalFound)
{
count++;
originalFound = true;
assertEquals(share.getMetadata(), listShareItem.getMetadata());
assertEquals(share.getStorageUri(), listShareItem.getStorageUri());
}
else if (listShareItem.getName().equals(share.getName()) &&
listShareItem.isSnapshot() && !snapshotFound) {
count++;
snapshotFound = true;
assertEquals(snapshot.getMetadata(), listShareItem.getMetadata());
assertEquals(snapshot.getStorageUri(), listShareItem.getStorageUri());
}
}

assertEquals(2, count);
}
// @Test
// public void testListSharesWithSnapshot() throws StorageException, URISyntaxException {
// CloudFileClient fileClient = FileTestHelper.createCloudFileClient();
// CloudFileShare share = fileClient.getShareReference(UUID.randomUUID().toString());
// share.create();
//
// HashMap<String, String> shareMeta = new HashMap<String, String>();
// shareMeta.put("key1", "value1");
// share.setMetadata(shareMeta);
// share.uploadMetadata();
//
// CloudFileShare snapshot = share.createSnapshot();
// HashMap<String, String> meta2 = new HashMap<String, String>();
// meta2.put("key2", "value2");
// share.setMetadata(meta2);
// share.uploadMetadata();
//
// CloudFileClient client = FileTestHelper.createCloudFileClient();
// Iterable<CloudFileShare> listResult = client.listShares(share.name, ShareListingDetails.ALL, null, null);
//
// int count = 0;
// boolean originalFound = false;
// boolean snapshotFound = false;
// for (CloudFileShare listShareItem : listResult) {
// if (listShareItem.getName().equals(share.getName()) && !listShareItem.isSnapshot() && !originalFound)
// {
// count++;
// originalFound = true;
// assertEquals(share.getMetadata(), listShareItem.getMetadata());
// assertEquals(share.getStorageUri(), listShareItem.getStorageUri());
// }
// else if (listShareItem.getName().equals(share.getName()) &&
// listShareItem.isSnapshot() && !snapshotFound) {
// count++;
// snapshotFound = true;
// assertEquals(snapshot.getMetadata(), listShareItem.getMetadata());
// assertEquals(snapshot.getStorageUri(), listShareItem.getStorageUri());
// }
// }
//
// assertEquals(2, count);
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -480,70 +480,70 @@ private static void testMetadataFailures(CloudFileDirectory directory, String ke
directory.getMetadata().remove(key);
}

//@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 testSupportedDirectoryApisInShareSnapshot() throws StorageException, URISyntaxException {
CloudFileDirectory dir = this.share.getRootDirectoryReference().getDirectoryReference("dir1");
dir.deleteIfExists();
dir.create();
HashMap<String, String> meta = new HashMap<String, String>();
meta.put("key1", "value1");
dir.setMetadata(meta);
dir.uploadMetadata();
CloudFileShare snapshot = this.share.createSnapshot();
CloudFileDirectory snapshotDir = snapshot.getRootDirectoryReference().getDirectoryReference("dir1");

HashMap<String, String> meta2 = new HashMap<String, String>();
meta2.put("key2", "value2");
dir.setMetadata(meta2);
dir.uploadMetadata();
snapshotDir.downloadAttributes();

assertTrue(snapshotDir.getMetadata().size() == 1 && snapshotDir.getMetadata().get("key1").equals("value1"));
assertNotNull(snapshotDir.getProperties().getEtag());

dir.downloadAttributes();
assertTrue(dir.getMetadata().size() == 1 && dir.getMetadata().get("key2").equals("value2"));
assertNotNull(dir.getProperties().getEtag());
assertNotEquals(dir.getProperties().getEtag(), snapshotDir.getProperties().getEtag());

final UriQueryBuilder uriBuilder = new UriQueryBuilder();
uriBuilder.add("sharesnapshot", snapshot.snapshotID);
uriBuilder.add("restype", "directory");
CloudFileDirectory snapshotDir2 = new CloudFileDirectory(uriBuilder.addToURI(dir.getUri()), this.share.getServiceClient().getCredentials());
assertEquals(snapshot.snapshotID, snapshotDir2.getShare().snapshotID);
assertTrue(snapshotDir2.exists());

snapshot.delete();
}
// @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 testSupportedDirectoryApisInShareSnapshot() throws StorageException, URISyntaxException {
// CloudFileDirectory dir = this.share.getRootDirectoryReference().getDirectoryReference("dir1");
// dir.deleteIfExists();
// dir.create();
// HashMap<String, String> meta = new HashMap<String, String>();
// meta.put("key1", "value1");
// dir.setMetadata(meta);
// dir.uploadMetadata();
// CloudFileShare snapshot = this.share.createSnapshot();
// CloudFileDirectory snapshotDir = snapshot.getRootDirectoryReference().getDirectoryReference("dir1");
//
// HashMap<String, String> meta2 = new HashMap<String, String>();
// meta2.put("key2", "value2");
// dir.setMetadata(meta2);
// dir.uploadMetadata();
// snapshotDir.downloadAttributes();
//
// assertTrue(snapshotDir.getMetadata().size() == 1 && snapshotDir.getMetadata().get("key1").equals("value1"));
// assertNotNull(snapshotDir.getProperties().getEtag());
//
// dir.downloadAttributes();
// assertTrue(dir.getMetadata().size() == 1 && dir.getMetadata().get("key2").equals("value2"));
// assertNotNull(dir.getProperties().getEtag());
// assertNotEquals(dir.getProperties().getEtag(), snapshotDir.getProperties().getEtag());
//
// final UriQueryBuilder uriBuilder = new UriQueryBuilder();
// uriBuilder.add("sharesnapshot", snapshot.snapshotID);
// uriBuilder.add("restype", "directory");
// CloudFileDirectory snapshotDir2 = new CloudFileDirectory(uriBuilder.addToURI(dir.getUri()), this.share.getServiceClient().getCredentials());
// assertEquals(snapshot.snapshotID, snapshotDir2.getShare().snapshotID);
// assertTrue(snapshotDir2.exists());
//
// snapshot.delete();
// }

/*
[TestMethod]
Expand Down Expand Up @@ -874,8 +874,6 @@ public void eventOccurred(SendingRequestEvent eventArg) {
}
catch (StorageException e) {
fail("Delete should succeed.");
} catch (URISyntaxException e) {
fail("Delete should succeed.");
}
}
}
Expand Down
Loading

0 comments on commit 42a2846

Please sign in to comment.