Skip to content

Commit abf92ec

Browse files
committed
Merge pull request #10 from emgerner-msft/master
Android Storage Client Library 0.5.0
2 parents 7dfbe74 + f37855a commit abf92ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1285
-826
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ tmp/**/*
2222
*.swp
2323
*~.nib
2424
local.properties
25-
.settings/**
25+
*/.settings/**
2626
.loadpath
2727

2828
# External tool builders

ChangeLog.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2015.04.02 Version 0.5.0
2+
* Fixed a bug for all listing API's where next() would sometimes throw an exception if hasNext() had not been called even if there were more elements to iterate on.
3+
* Added sequence number to the blob properties. This is populated for page blobs.
4+
* Creating a page blob sets its length property.
5+
* Added support for page blob sequence numbers and sequence number access conditions.
6+
* Fixed a bug in abort copy where the lease access condition was not sent to the service.
7+
* Fixed an issue in startCopyFromBlob where if the URI of the source blob contained certain non-ASCII characters they would not be encoded appropriately. This would result in Authorization failures.
8+
* Fixed a bug in BlobOutputStream and FileOutputStream where flush added data to a request pool rather than immediately committing it to the Azure service.
9+
* Refactored to remove the blob, queue, and file package dependency on table in the error handling code.
10+
* Added additional client-side logging for REST requests, responses, and errors.
11+
112
2015.01 Version 0.4.1
213
* Fixed a bug for Android 5.0 only that caused auth failures on deletes.
314

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ First, add mavenCentral to your repositories by adding the following to your gra
4444
Then, add a dependency by adding the following to your gradle build file:
4545

4646
dependencies {
47-
compile 'com.microsoft.azure.android:azure-storage-android:0.4.1@aar'
47+
compile 'com.microsoft.azure.android:azure-storage-android:0.5.0@aar'
4848
}
4949

5050
###Option 4: aar via Maven
@@ -55,7 +55,7 @@ To get the binaries of this library as distributed by Microsoft, ready for use w
5555
<dependency>
5656
<groupId>com.microsoft.azure.android</groupId>
5757
<artifactId>azure-storage-android</artifactId>
58-
<version>0.4.1</version>
58+
<version>0.5.0</version>
5959
<type>aar</type>
6060
</dependency>
6161
```

microsoft-azure-storage-samples/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.microsoft.azure.storage.samples"
44
android:versionCode="0"
5-
android:versionName="0.4.1" >
5+
android:versionName="0.5.0" >
66

77
<uses-sdk
88
android:minSdkVersion="15"

microsoft-azure-storage-test/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
1212
package="com.microsoft.azure.android.test"
1313
android:versionCode="0"
14-
android:versionName="0.4.1" >
14+
android:versionName="0.5.0" >
1515

1616
<uses-sdk
1717
android:minSdkVersion="15"

microsoft-azure-storage-test/src/com/microsoft/azure/storage/ServicePropertiesTests.java

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -770,14 +770,6 @@ else if (client.getClass().equals(CloudQueueClient.class)) {
770770

771771
/**
772772
* Takes a CorsRule and tries to upload it. Then tries to download it and compares it to the initial CorsRule.
773-
*
774-
* @param rule
775-
* @param client
776-
* TODO
777-
* @param props
778-
* TODO
779-
* @throws StorageException
780-
* @throws InterruptedException
781773
*/
782774
private void testCorsRules(CorsRule rule, ServiceClient client, ServiceProperties props) throws StorageException,
783775
InterruptedException {
@@ -792,15 +784,6 @@ private void testCorsRules(CorsRule rule, ServiceClient client, ServicePropertie
792784
/**
793785
* Takes a List of CorsRules and tries to upload them. Then tries to download them and compares the list to the
794786
* initial CorsRule List.
795-
*
796-
* @param client
797-
* TODO
798-
* @param props
799-
* TODO
800-
* @param rule
801-
*
802-
* @throws StorageException
803-
* @throws InterruptedException
804787
*/
805788
private void testCorsRules(List<CorsRule> corsRules, ServiceClient client, ServiceProperties props)
806789
throws StorageException, InterruptedException {
@@ -817,9 +800,6 @@ private void testCorsRules(List<CorsRule> corsRules, ServiceClient client, Servi
817800

818801
/**
819802
* Checks two ServiceProperties for equality
820-
*
821-
* @param propsA
822-
* @param propsB
823803
*/
824804
private static void assertServicePropertiesAreEqual(ServiceProperties propsA, ServiceProperties propsB) {
825805
if (propsA.getLogging() != null && propsB.getLogging() != null) {

microsoft-azure-storage-test/src/com/microsoft/azure/storage/StorageAccountTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,15 @@ public void testStorageCredentialsSharedKey() throws URISyntaxException, Storage
6868
}
6969

7070
public void testStorageCredentialsSAS() throws URISyntaxException, StorageException {
71-
String token = "?sp=abcde&api-version=2014-02-14&sig=1";
72-
71+
String token = "?sig=1&api-version=2014-02-14&sp=abcde";
7372
StorageCredentialsSharedAccessSignature cred = new StorageCredentialsSharedAccessSignature(token);
74-
7573
assertNull(cred.getAccountName());
7674

7775
URI testUri = new URI("http://test/abc");
7876
assertEquals(testUri + token, cred.transformUri(testUri).toString());
7977

8078
testUri = new URI("http://test/abc?query=a&query2=b");
81-
String expectedUri = "http://test/abc?api-version=2014-02-14&sp=abcde&query=a&query2=b&sig=1";
79+
String expectedUri = "http://test/abc?sig=1&api-version=2014-02-14&query=a&sp=abcde&query2=b";
8280
assertEquals(expectedUri, cred.transformUri(testUri).toString());
8381
}
8482

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ public static void assertAreEqual(BlobProperties prop1, BlobProperties prop2) {
315315
Assert.assertEquals(prop1.getEtag(), prop2.getEtag());
316316
Assert.assertEquals(prop1.getLastModified(), prop2.getLastModified());
317317
Assert.assertEquals(prop1.getLength(), prop2.getLength());
318+
Assert.assertEquals(prop1.getPageBlobSequenceNumber(), prop2.getPageBlobSequenceNumber());
318319
}
319320
}
320321

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

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
import java.util.EnumSet;
2323
import java.util.GregorianCalendar;
2424
import java.util.HashMap;
25+
import java.util.Iterator;
2526
import java.util.List;
2627
import java.util.TimeZone;
2728
import java.util.UUID;
28-
2929
import junit.framework.Assert;
3030
import junit.framework.TestCase;
31-
31+
import android.annotation.SuppressLint;
3232
import com.microsoft.azure.storage.Constants;
3333
import com.microsoft.azure.storage.NameValidator;
3434
import com.microsoft.azure.storage.OperationContext;
@@ -433,6 +433,34 @@ public void testCloudBlobContainerListBlobs() throws StorageException, IOExcepti
433433
assertTrue(blobNames.size() == 0);
434434
}
435435

436+
/**
437+
* List the blobs in a container with next(). This tests for the item in the changelog: "Fixed a bug for all
438+
* listing API's where next() would sometimes throw an exception if hasNext() had not been called even if
439+
* there were more elements to iterate on."
440+
*
441+
* @throws URISyntaxException
442+
* @throws StorageException
443+
* @throws IOException
444+
*/
445+
public void testCloudBlobContainerListBlobsNext() throws StorageException, IOException, URISyntaxException {
446+
this.container.create();
447+
448+
int numBlobs = 10;
449+
List<String> blobNames = BlobTestHelper.uploadNewBlobs(this.container, BlobType.PAGE_BLOB, 10, 512, null);
450+
assertEquals(numBlobs, blobNames.size());
451+
452+
// hasNext first
453+
Iterator<ListBlobItem> iter = this.container.listBlobs().iterator();
454+
iter.hasNext();
455+
iter.next();
456+
iter.next();
457+
458+
// next without hasNext
459+
iter = this.container.listBlobs().iterator();
460+
iter.next();
461+
iter.next();
462+
}
463+
436464
/**
437465
* Try to list the blobs in a container to ensure maxResults validation is working.
438466
*
@@ -590,7 +618,8 @@ private static void assertPermissionsEqual(BlobContainerPermissions expected, Bl
590618
* @throws StorageException
591619
* @throws URISyntaxException
592620
*/
593-
private static void assertCreatedAndListedBlobsEquivalent(CloudBlockBlob createdBlob, CloudBlockBlob listedBlob,
621+
@SuppressLint("UseValueOf")
622+
private static void assertCreatedAndListedBlobsEquivalent(CloudBlockBlob createdBlob, CloudBlockBlob listedBlob,
594623
int length) throws StorageException, URISyntaxException{
595624
assertEquals(createdBlob.getContainer().getName(), listedBlob.getContainer().getName());
596625
assertEquals(createdBlob.getMetadata(), listedBlob.getMetadata());

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,8 @@ private void testFlatListingWithDirectory(String delimiter, CloudBlobContainer c
362362
null), get22.getUri());
363363
}
364364

365-
public void testFlatListingWithDirectorySegmented() throws URISyntaxException, StorageException {
365+
// Re-enable after fix in 3.0 with int->Integer
366+
public void ignoreTestFlatListingWithDirectorySegmented() throws URISyntaxException, StorageException {
366367
for (int i = 0; i < delimiters.length; i++) {
367368
CloudBlobContainer container = null;
368369
try {

0 commit comments

Comments
 (0)