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

Commit e7abcb5

Browse files
author
jofriedm-msft
authored
Merge pull request #205 from jofriedm-msft/master
5.5.0 Release
2 parents 1f0b8de + cf0d536 commit e7abcb5

File tree

20 files changed

+483
-91
lines changed

20 files changed

+483
-91
lines changed

ChangeLog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
2017.08.28 Version 5.5.0
2+
* Fixed a bug when using a SAS token where the token was being omitted from calls to delete a directory in the file service.
3+
* For Standard Storage Accounts only, added the ability to set the tier of individual block blobs. The tier can currently only be set through uploadTier()
4+
15
2017.07.13 Version 5.4.0
26
* Support for 2017-04-17 REST version. Please see our REST API documentation and blogs for information about the related added features.
37
* Added ErrorReceivingResponseEvent which fires when a network error occurs before the responseReceivedEvent fires. If the responseReceivedEvent fires sucessfully, this new event will not fire.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
3030
<dependency>
3131
<groupId>com.microsoft.azure</groupId>
3232
<artifactId>azure-storage</artifactId>
33-
<version>5.4.0</version>
33+
<version>5.5.0</version>
3434
</dependency>
3535
```
3636

microsoft-azure-storage-samples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<dependency>
2727
<groupId>com.microsoft.azure</groupId>
2828
<artifactId>azure-storage</artifactId>
29-
<version>5.4.0</version>
29+
<version>5.5.0</version>
3030
</dependency>
3131
<dependency>
3232
<groupId>com.microsoft.azure</groupId>

microsoft-azure-storage-samples/src/com/microsoft/azure/storage/logging/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<dependency>
2727
<groupId>com.microsoft.azure</groupId>
2828
<artifactId>azure-storage</artifactId>
29-
<version>5.4.0</version>
29+
<version>5.5.0</version>
3030
</dependency>
3131
<dependency>
3232
<groupId>com.microsoft.azure</groupId>

microsoft-azure-storage-test/src/com/microsoft/azure/storage/blob/CloudBlockBlobTests.java

Lines changed: 79 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,7 @@
4848
import java.net.URI;
4949
import java.net.URISyntaxException;
5050
import java.security.InvalidKeyException;
51-
import java.util.ArrayList;
52-
import java.util.Calendar;
53-
import java.util.Date;
54-
import java.util.EnumSet;
55-
import java.util.GregorianCalendar;
56-
import java.util.List;
57-
import java.util.Map;
58-
import java.util.Random;
59-
import java.util.TimeZone;
51+
import java.util.*;
6052

6153
import com.microsoft.azure.storage.StorageErrorCodeStrings;
6254
import com.microsoft.azure.storage.TestRunners.CloudTests;
@@ -1942,4 +1934,82 @@ private void doCloudBlockBlobCopy(boolean sourceIsSas, boolean destinationIsSas)
19421934
destination.delete();
19431935
source.delete();
19441936
}
1937+
1938+
@Test
1939+
@Category({ DevFabricTests.class, DevStoreTests.class })
1940+
public void testCloudBlockBlobUploadStandardTier() throws StorageException, IOException, URISyntaxException {
1941+
for (StandardBlobTier standardBlobTier : StandardBlobTier.values()) {
1942+
if (standardBlobTier == StandardBlobTier.UNKNOWN) {
1943+
continue;
1944+
}
1945+
1946+
final String blobName = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlob");
1947+
final CloudBlockBlob blob = this.container.getBlockBlobReference(blobName);
1948+
blob.uploadText("text");
1949+
1950+
blob.uploadStandardBlobTier(standardBlobTier);
1951+
assertEquals(standardBlobTier, blob.getProperties().getStandardBlobTier());
1952+
assertNull(blob.getProperties().getPremiumPageBlobTier());
1953+
assertNull(blob.getProperties().getRehydrationStatus());
1954+
1955+
CloudBlockBlob blob2 = this.container.getBlockBlobReference(blobName);
1956+
blob2.downloadAttributes();
1957+
assertEquals(standardBlobTier, blob2.getProperties().getStandardBlobTier());
1958+
assertNull(blob2.getProperties().getPremiumPageBlobTier());
1959+
assertNull(blob2.getProperties().getRehydrationStatus());
1960+
1961+
CloudBlockBlob blob3 = (CloudBlockBlob)this.container.listBlobs().iterator().next();
1962+
assertEquals(standardBlobTier, blob3.getProperties().getStandardBlobTier());
1963+
assertNull(blob3.getProperties().getPremiumPageBlobTier());
1964+
assertNull(blob3.getProperties().getRehydrationStatus());
1965+
1966+
blob.deleteIfExists();
1967+
}
1968+
}
1969+
1970+
@Test
1971+
@Category({ DevFabricTests.class, DevStoreTests.class })
1972+
public void testCloudBlockBlobRehydrateBlob() throws StorageException, IOException, URISyntaxException {
1973+
final String blobName1 = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlob1");
1974+
final String blobName2 = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlob2");
1975+
final CloudBlockBlob blob = this.container.getBlockBlobReference(blobName1);
1976+
blob.uploadText("text");
1977+
blob.uploadStandardBlobTier(StandardBlobTier.ARCHIVE);
1978+
final CloudBlockBlob blob2 = this.container.getBlockBlobReference(blobName2);
1979+
blob2.uploadText("text");
1980+
blob2.uploadStandardBlobTier(StandardBlobTier.ARCHIVE);
1981+
1982+
CloudBlockBlob blobRef1 = this.container.getBlockBlobReference(blobName1);
1983+
blobRef1.uploadStandardBlobTier(StandardBlobTier.COOL);
1984+
assertNull(blobRef1.getProperties().getRehydrationStatus());
1985+
assertEquals(StandardBlobTier.ARCHIVE, blobRef1.getProperties().getStandardBlobTier());
1986+
assertNull(blobRef1.getProperties().getPremiumPageBlobTier());
1987+
1988+
blob.downloadAttributes();
1989+
assertEquals(RehydrationStatus.PENDING_TO_COOL, blob.getProperties().getRehydrationStatus());
1990+
assertEquals(StandardBlobTier.ARCHIVE, blob.getProperties().getStandardBlobTier());
1991+
assertNull(blob.getProperties().getPremiumPageBlobTier());
1992+
1993+
CloudBlockBlob blobRef2 = this.container.getBlockBlobReference(blobName2);
1994+
blobRef2.uploadStandardBlobTier(StandardBlobTier.HOT);
1995+
assertNull(blobRef2.getProperties().getRehydrationStatus());
1996+
assertEquals(StandardBlobTier.ARCHIVE, blobRef2.getProperties().getStandardBlobTier());
1997+
assertNull(blobRef2.getProperties().getPremiumPageBlobTier());
1998+
1999+
blob2.downloadAttributes();
2000+
assertEquals(RehydrationStatus.PENDING_TO_HOT, blob2.getProperties().getRehydrationStatus());
2001+
assertEquals(StandardBlobTier.ARCHIVE, blob2.getProperties().getStandardBlobTier());
2002+
assertNull(blob2.getProperties().getPremiumPageBlobTier());
2003+
2004+
Iterator it = this.container.listBlobs().iterator();
2005+
CloudBlockBlob listBlob = (CloudBlockBlob)it.next();
2006+
assertEquals(RehydrationStatus.PENDING_TO_COOL, listBlob.getProperties().getRehydrationStatus());
2007+
assertEquals(StandardBlobTier.ARCHIVE, listBlob.getProperties().getStandardBlobTier());
2008+
assertNull(listBlob.getProperties().getPremiumPageBlobTier());
2009+
2010+
CloudBlockBlob listBlob2 = (CloudBlockBlob)it.next();
2011+
assertEquals(RehydrationStatus.PENDING_TO_HOT, listBlob2.getProperties().getRehydrationStatus());
2012+
assertEquals(StandardBlobTier.ARCHIVE, listBlob2.getProperties().getStandardBlobTier());
2013+
assertNull(listBlob2.getProperties().getPremiumPageBlobTier());
2014+
}
19452015
}

microsoft-azure-storage-test/src/com/microsoft/azure/storage/blob/CloudPageBlobTests.java

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,39 +1242,47 @@ public void testCloudPageBlobSetPremiumBlobTierOnCreate() throws URISyntaxExcept
12421242

12431243
// Test create API
12441244
CloudPageBlob blob = container.getPageBlobReference(blobName);
1245-
assertNull(blob.getProperties().getInferredBlobTier());
1245+
assertNull(blob.getProperties().isBlobTierInferred());
12461246
blob.create(1024, PremiumPageBlobTier.P4, null, null, null);
12471247
assertEquals(PremiumPageBlobTier.P4, blob.getProperties().getPremiumPageBlobTier());
1248-
assertFalse(blob.getProperties().getInferredBlobTier());
1248+
assertFalse(blob.getProperties().isBlobTierInferred());
1249+
assertNull(blob.getProperties().getStandardBlobTier());
1250+
assertNull(blob.getProperties().getRehydrationStatus());
12491251

12501252
CloudPageBlob blob2 = container.getPageBlobReference(blobName);
12511253
blob2.downloadAttributes();
12521254
assertEquals(PremiumPageBlobTier.P4, blob2.getProperties().getPremiumPageBlobTier());
1253-
assertNull(blob2.getProperties().getInferredBlobTier());
1255+
assertNull(blob2.getProperties().isBlobTierInferred());
1256+
assertNull(blob2.getProperties().getStandardBlobTier());
1257+
assertNull(blob2.getProperties().getRehydrationStatus());
12541258

12551259
// Test upload from byte array API
12561260
byte[] buffer = BlobTestHelper.getRandomBuffer(1024);
12571261
CloudPageBlob blob3 = container.getPageBlobReference("blob3");
12581262
blob3.uploadFromByteArray(buffer, 0, 1024, PremiumPageBlobTier.P6, null, null, null);
12591263
assertEquals(PremiumPageBlobTier.P6, blob3.getProperties().getPremiumPageBlobTier());
1260-
assertFalse(blob3.getProperties().getInferredBlobTier());
1264+
assertFalse(blob3.getProperties().isBlobTierInferred());
1265+
assertNull(blob3.getProperties().getStandardBlobTier());
1266+
assertNull(blob3.getProperties().getRehydrationStatus());
12611267

12621268
CloudPageBlob blob3Ref = container.getPageBlobReference("blob3");
12631269
blob3Ref.downloadAttributes();
12641270
assertEquals(PremiumPageBlobTier.P6, blob3Ref.getProperties().getPremiumPageBlobTier());
1265-
assertNull(blob3Ref.getProperties().getInferredBlobTier());
1271+
assertNull(blob3Ref.getProperties().isBlobTierInferred());
12661272

12671273
// Test upload from stream API
12681274
ByteArrayInputStream srcStream = new ByteArrayInputStream(buffer);
12691275
CloudPageBlob blob4 = container.getPageBlobReference("blob4");
12701276
blob4.upload(srcStream, 1024, PremiumPageBlobTier.P10, null, null, null);
12711277
assertEquals(PremiumPageBlobTier.P10, blob4.getProperties().getPremiumPageBlobTier());
1272-
assertFalse(blob4.getProperties().getInferredBlobTier());
1278+
assertFalse(blob4.getProperties().isBlobTierInferred());
1279+
assertNull(blob4.getProperties().getStandardBlobTier());
1280+
assertNull(blob4.getProperties().getRehydrationStatus());
12731281

12741282
CloudPageBlob blob4Ref = container.getPageBlobReference("blob4");
12751283
blob4Ref.downloadAttributes();
12761284
assertEquals(PremiumPageBlobTier.P10, blob4Ref.getProperties().getPremiumPageBlobTier());
1277-
assertNull(blob4Ref.getProperties().getInferredBlobTier());
1285+
assertNull(blob4Ref.getProperties().isBlobTierInferred());
12781286

12791287
// Test upload from file API
12801288
File sourceFile = File.createTempFile("sourceFile", ".tmp");
@@ -1286,12 +1294,14 @@ public void testCloudPageBlobSetPremiumBlobTierOnCreate() throws URISyntaxExcept
12861294
CloudPageBlob blob5 = container.getPageBlobReference("blob5");
12871295
blob5.uploadFromFile(sourceFile.getAbsolutePath(), PremiumPageBlobTier.P20, null, null, null);
12881296
assertEquals(PremiumPageBlobTier.P20, blob5.getProperties().getPremiumPageBlobTier());
1289-
assertFalse(blob5.getProperties().getInferredBlobTier());
1297+
assertFalse(blob5.getProperties().isBlobTierInferred());
1298+
assertNull(blob5.getProperties().getStandardBlobTier());
1299+
assertNull(blob5.getProperties().getRehydrationStatus());
12901300

12911301
CloudPageBlob blob5Ref = container.getPageBlobReference("blob5");
12921302
blob5Ref.downloadAttributes();
12931303
assertEquals(PremiumPageBlobTier.P20, blob5Ref.getProperties().getPremiumPageBlobTier());
1294-
assertNull(blob5Ref.getProperties().getInferredBlobTier());
1304+
assertNull(blob5Ref.getProperties().isBlobTierInferred());
12951305
}
12961306
finally {
12971307
container.deleteIfExists();
@@ -1307,19 +1317,21 @@ public void testCloudPageBlobSetBlobTier() throws URISyntaxException, StorageExc
13071317
String blobName = BlobTestHelper.generateRandomBlobNameWithPrefix("testblob");
13081318
CloudPageBlob blob = container.getPageBlobReference(blobName);
13091319
blob.create(1024);
1310-
assertNull(blob.getProperties().getInferredBlobTier());
1320+
assertNull(blob.getProperties().isBlobTierInferred());
13111321
blob.downloadAttributes();
1312-
assertTrue(blob.getProperties().getInferredBlobTier());
1322+
assertTrue(blob.getProperties().isBlobTierInferred());
13131323
assertEquals(PremiumPageBlobTier.P10, blob.getProperties().getPremiumPageBlobTier());
13141324

13151325
blob.uploadPremiumPageBlobTier(PremiumPageBlobTier.P40);
13161326
assertEquals(PremiumPageBlobTier.P40, blob.properties.getPremiumPageBlobTier());
1317-
assertFalse(blob.getProperties().getInferredBlobTier());
1327+
assertFalse(blob.getProperties().isBlobTierInferred());
1328+
assertNull(blob.getProperties().getStandardBlobTier());
1329+
assertNull(blob.getProperties().getRehydrationStatus());
13181330

13191331
CloudPageBlob blob2 = container.getPageBlobReference(blobName);
13201332
blob2.downloadAttributes();
13211333
assertEquals(PremiumPageBlobTier.P40, blob2.properties.getPremiumPageBlobTier());
1322-
assertNull(blob2.getProperties().getInferredBlobTier());
1334+
assertNull(blob2.getProperties().isBlobTierInferred());
13231335

13241336
boolean pageBlobWithTierFound = false;
13251337
for (ListBlobItem blobItem : container.listBlobs()) {
@@ -1328,7 +1340,9 @@ public void testCloudPageBlobSetBlobTier() throws URISyntaxException, StorageExc
13281340
if (blob.getName().equals(blobName) && !pageBlobWithTierFound) {
13291341
// Check that the blob is found exactly once
13301342
assertEquals(PremiumPageBlobTier.P40, blob3.properties.getPremiumPageBlobTier());
1331-
assertFalse(blob3.getProperties().getInferredBlobTier());
1343+
assertNull(blob3.getProperties().isBlobTierInferred());
1344+
assertNull(blob3.getProperties().getStandardBlobTier());
1345+
assertNull(blob3.getProperties().getRehydrationStatus());
13321346
pageBlobWithTierFound = true;
13331347
} else if (blob.getName().equals(blobName)) {
13341348
fail("Page blob found twice");
@@ -1379,14 +1393,18 @@ public void testCloudPageBlobSetBlobTierOnCopy() throws URISyntaxException, Stor
13791393
assertEquals(BlobType.PAGE_BLOB, copy.getProperties().getBlobType());
13801394
assertEquals(PremiumPageBlobTier.P30, copy.getProperties().getPremiumPageBlobTier());
13811395
assertEquals(PremiumPageBlobTier.P10, source.getProperties().getPremiumPageBlobTier());
1382-
assertFalse(source.getProperties().getInferredBlobTier());
1383-
assertFalse(copy.getProperties().getInferredBlobTier());
1396+
assertFalse(source.getProperties().isBlobTierInferred());
1397+
assertFalse(copy.getProperties().isBlobTierInferred());
1398+
assertNull(source.getProperties().getStandardBlobTier());
1399+
assertNull(source.getProperties().getRehydrationStatus());
1400+
assertNull(copy.getProperties().getStandardBlobTier());
1401+
assertNull(copy.getProperties().getRehydrationStatus());
13841402
BlobTestHelper.waitForCopy(copy);
13851403

13861404
CloudPageBlob copyRef = container.getPageBlobReference("copy");
13871405
copyRef.downloadAttributes();
13881406
assertEquals(PremiumPageBlobTier.P30, copyRef.getProperties().getPremiumPageBlobTier());
1389-
assertNull(copyRef.getProperties().getInferredBlobTier());
1407+
assertNull(copyRef.getProperties().isBlobTierInferred());
13901408

13911409
// copy where source does not have a tier
13921410
CloudPageBlob source2 = container.getPageBlobReference("source2");
@@ -1397,8 +1415,12 @@ public void testCloudPageBlobSetBlobTierOnCopy() throws URISyntaxException, Stor
13971415
assertEquals(BlobType.PAGE_BLOB, copy3.getProperties().getBlobType());
13981416
assertEquals(PremiumPageBlobTier.P60, copy3.getProperties().getPremiumPageBlobTier());
13991417
assertNull(source2.getProperties().getPremiumPageBlobTier());
1400-
assertNull(source2.getProperties().getInferredBlobTier());
1401-
assertFalse(copy3.getProperties().getInferredBlobTier());
1418+
assertNull(source2.getProperties().isBlobTierInferred());
1419+
assertFalse(copy3.getProperties().isBlobTierInferred());
1420+
assertNull(source2.getProperties().getStandardBlobTier());
1421+
assertNull(source2.getProperties().getRehydrationStatus());
1422+
assertNull(copy3.getProperties().getStandardBlobTier());
1423+
assertNull(copy3.getProperties().getRehydrationStatus());
14021424
}
14031425
finally {
14041426
container.deleteIfExists();

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public void testDirectorySas() throws InvalidKeyException, IllegalArgumentExcept
131131
file.create(512);
132132

133133
SharedAccessFilePolicy policy = createSharedAccessPolicy(
134-
EnumSet.of(SharedAccessFilePermissions.READ, SharedAccessFilePermissions.LIST), 300);
134+
EnumSet.of(SharedAccessFilePermissions.READ, SharedAccessFilePermissions.LIST, SharedAccessFilePermissions.DELETE), 300);
135135

136136
// Test directory SAS with a file SAS token from an identically named file
137137
String sas = file.generateSharedAccessSignature(policy, null);
@@ -148,6 +148,10 @@ public void testDirectorySas() throws InvalidKeyException, IllegalArgumentExcept
148148
sas = this.share.generateSharedAccessSignature(policy, null);
149149
sasDir = new CloudFileDirectory(new URI(dir.getUri().toString() + "?" + sas));
150150
sasDir.downloadAttributes();
151+
152+
// Test deleting a directory using a SAS token. The directory must be empty for this request to succeed.
153+
file.delete();
154+
sasDir.delete();
151155
}
152156

153157
@Test

microsoft-azure-storage/src/com/microsoft/azure/storage/Constants.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ public static class HeaderConstants {
661661
/**
662662
* Specifies the value to use for UserAgent header.
663663
*/
664-
public static final String USER_AGENT_VERSION = "5.4.0";
664+
public static final String USER_AGENT_VERSION = "5.5.0";
665665

666666
/**
667667
* The default type for content-type and accept
@@ -899,6 +899,11 @@ public static class QueryConstants {
899899
*/
900900
public static final String ACCESS_TIER = "AccessTier";
901901

902+
/**
903+
* XML element for the archive status.
904+
*/
905+
public static final String ARCHIVE_STATUS = "ArchiveStatus";
906+
902907
/**
903908
* Buffer width used to copy data to output streams.
904909
*/

microsoft-azure-storage/src/com/microsoft/azure/storage/ServicePropertiesHandler.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public static ServiceProperties readServicePropertiesFromStream(final InputStrea
5858
IOException, ParserConfigurationException {
5959
SAXParser saxParser = Utility.getSAXParser();
6060
ServicePropertiesHandler handler = new ServicePropertiesHandler();
61+
handler.props.setCors(null);
62+
handler.props.setHourMetrics(null);
63+
handler.props.setMinuteMetrics(null);
64+
handler.props.setCors(null);
6165
saxParser.parse(stream, handler);
6266

6367
return handler.props;
@@ -70,6 +74,18 @@ public void startElement(String uri, String localName, String qName, Attributes
7074
if (Constants.AnalyticsConstants.CORS_RULE_ELEMENT.equals(localName)) {
7175
this.rule = new CorsRule();
7276
}
77+
else if (Constants.AnalyticsConstants.LOGGING_ELEMENT.equals(localName)) {
78+
this.props.setLogging(new LoggingProperties());
79+
}
80+
else if (Constants.AnalyticsConstants.HOUR_METRICS_ELEMENT.equals(localName)) {
81+
this.props.setHourMetrics(new MetricsProperties());
82+
}
83+
else if (Constants.AnalyticsConstants.MINUTE_METRICS_ELEMENT.equals(localName)) {
84+
this.props.setMinuteMetrics(new MetricsProperties());
85+
}
86+
else if (Constants.AnalyticsConstants.CORS_ELEMENT.equals(localName)) {
87+
this.props.setCors(new CorsProperties());
88+
}
7389
}
7490

7591
@Override

microsoft-azure-storage/src/com/microsoft/azure/storage/blob/BlobConstants.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,17 @@ final class BlobConstants {
3030
* The header that specifies if the access tier is inferred.
3131
*/
3232
public static final String ACCESS_TIER_INFERRED_HEADER = Constants.PREFIX_FOR_STORAGE_HEADER + "access-tier-inferred";
33+
3334
/**
3435
* Specifies the append blob type.
3536
*/
3637
public static final String APPEND_BLOB = "AppendBlob";
3738

39+
/**
40+
* The header that specifies the archive status.
41+
*/
42+
public static final String ARCHIVE_STATUS_HEADER = Constants.PREFIX_FOR_STORAGE_HEADER + "archive-status";
43+
3844
/**
3945
* XML element for authentication error details.
4046
*/

0 commit comments

Comments
 (0)