Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #73 from pemari-msft/master
Browse files Browse the repository at this point in the history
Storage Client Library - 4.2.1
  • Loading branch information
vinaysh-msft committed Aug 13, 2014
2 parents 5b83e4a + efea8ca commit 62c2b90
Show file tree
Hide file tree
Showing 20 changed files with 90 additions and 25 deletions.
6 changes: 5 additions & 1 deletion Lib/Common/Blob/CloudBlockBlob.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,11 @@ private void ParseQueryAndVerify(StorageUri address, StorageCredentials credenti
this.SnapshotTime = parsedSnapshot;
}

this.ServiceClient = new CloudBlobClient(NavigationHelper.GetServiceClientBaseAddress(this.StorageUri, null /* usePathStyleUris */), credentials ?? parsedCredentials);
if (this.ServiceClient == null)
{
this.ServiceClient = new CloudBlobClient(NavigationHelper.GetServiceClientBaseAddress(this.StorageUri, null /* usePathStyleUris */), credentials ?? parsedCredentials);
}

this.Name = NavigationHelper.GetBlobName(this.Uri, this.ServiceClient.UsePathStyleUris);
}
}
Expand Down
6 changes: 5 additions & 1 deletion Lib/Common/Blob/CloudPageBlob.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,11 @@ private void ParseQueryAndVerify(StorageUri address, StorageCredentials credenti
this.SnapshotTime = parsedSnapshot;
}

this.ServiceClient = new CloudBlobClient(NavigationHelper.GetServiceClientBaseAddress(this.StorageUri, null /* usePathStyleUris */), credentials ?? parsedCredentials);
if (this.ServiceClient == null)
{
this.ServiceClient = new CloudBlobClient(NavigationHelper.GetServiceClientBaseAddress(this.StorageUri, null /* usePathStyleUris */), credentials ?? parsedCredentials);
}

this.Name = NavigationHelper.GetBlobName(this.Uri, this.ServiceClient.UsePathStyleUris);
}
}
Expand Down
6 changes: 5 additions & 1 deletion Lib/Common/File/CloudFile.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,11 @@ public CloudFileDirectory Parent
private void ParseQueryAndVerify(StorageUri address, StorageCredentials credentials)
{
this.attributes.StorageUri = address;
this.ServiceClient = new CloudFileClient(NavigationHelper.GetServiceClientBaseAddress(this.StorageUri, null /* usePathStyleUris */), credentials);
if (this.ServiceClient == null)
{
this.ServiceClient = new CloudFileClient(NavigationHelper.GetServiceClientBaseAddress(this.StorageUri, null /* usePathStyleUris */), credentials);
}

this.Name = NavigationHelper.GetFileName(this.Uri, this.ServiceClient.UsePathStyleUris);
}
}
Expand Down
2 changes: 1 addition & 1 deletion Lib/Common/Shared/Protocol/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ static HeaderConstants()
/// <summary>
/// Specifies the value to use for UserAgent header.
/// </summary>
public const string UserAgentProductVersion = "4.2.0";
public const string UserAgentProductVersion = "4.2.1";

/// <summary>
/// Master Windows Azure Storage header prefix.
Expand Down
11 changes: 9 additions & 2 deletions Lib/Common/StorageException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ private static StorageException CoreTranslate(Exception ex, RequestResult reqRes
else if (ex is TimeoutException)
{
reqResult.HttpStatusMessage = null;
reqResult.HttpStatusCode = (int)HttpStatusCode.Unused;
reqResult.HttpStatusCode = (int)HttpStatusCode.RequestTimeout;
reqResult.ExtendedErrorInformation = null;
return new StorageException(reqResult, ex.Message, ex);
}
Expand Down Expand Up @@ -309,7 +309,7 @@ internal static StorageException TranslateDataServiceException(Exception ex, Req
else if (ex is TimeoutException)
{
reqResult.HttpStatusMessage = null;
reqResult.HttpStatusCode = (int)HttpStatusCode.Unused;
reqResult.HttpStatusCode = (int)HttpStatusCode.RequestTimeout;
reqResult.ExtendedErrorInformation = null;
return new StorageException(reqResult, ex.Message, ex);
}
Expand Down Expand Up @@ -351,6 +351,13 @@ private static void PopulateRequestResult(RequestResult reqResult, HttpWebRespon
string tempDate = HttpWebUtility.TryGetHeader(response, "Date", null);
reqResult.RequestDate = string.IsNullOrEmpty(tempDate) ? DateTime.Now.ToString("R", CultureInfo.InvariantCulture) : tempDate;
reqResult.Etag = response.Headers[HttpResponseHeader.ETag];
#endif
}

if (response.ContentLength > 0)
{
#if !WINDOWS_RT
reqResult.IngressBytes += response.ContentLength;
#endif
}
}
Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsDesktop/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.2.1.0")]

#if SIGN
[assembly: InternalsVisibleTo(
Expand Down
2 changes: 1 addition & 1 deletion Lib/WindowsDesktop/WindowsAzure.Storage.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>WindowsAzure.Storage</id>
<version>4.2.0</version>
<version>4.2.1</version>
<title>Windows Azure Storage</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsPhone/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.2.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]

#if SIGN
Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsRuntime/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.2.1.0")]
[assembly: ComVisible(false)]

#if SIGN
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Microsoft Azure Storage SDK for .NET (4.2.0)
# Microsoft Azure Storage SDK for .NET (4.2.1)

The Microsoft Azure Storage SDK for .NET allows you to build Azure applications
that take advantage of scalable cloud computing resources.
Expand Down
13 changes: 13 additions & 0 deletions Test/ClassLibraryCommon/Blob/BlobManglerUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,19 @@ public void BlobIngressEgressCounters()
});

Assert.AreEqual(blob.Properties.Length, 98765 + 1024 + 1);

// Error Case
CloudBlockBlob nullBlob = container.GetBlockBlobReference("null");
OperationContext errorContext = new OperationContext();
try
{
nullBlob.DownloadToStream(Stream.Null, null, new BlobRequestOptions() { RetryPolicy = new RetryPolicies.NoRetry() }, errorContext);
Assert.Fail("Null blob, null stream, no download possible.");
}
catch (StorageException)
{
Assert.IsTrue(errorContext.LastResult.IngressBytes > 0);
}
}
finally
{
Expand Down
5 changes: 4 additions & 1 deletion Test/ClassLibraryCommon/Blob/CloudBlobContainerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2060,7 +2060,9 @@ public void CloudBlobContainerSetMetadataTask()
[TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)]
public void CloudBlobContainerListBlobs()
{
CloudBlobContainer container = GetRandomContainerReference();
CloudBlobClient client = GenerateCloudBlobClient();
client.DefaultRequestOptions.LocationMode = RetryPolicies.LocationMode.PrimaryThenSecondary;
CloudBlobContainer container = client.GetContainerReference(GetRandomContainerName());
try
{
container.Create();
Expand All @@ -2072,6 +2074,7 @@ public void CloudBlobContainerListBlobs()
{
Assert.IsInstanceOfType(blobItem, typeof(CloudPageBlob));
Assert.IsTrue(blobNames.Remove(((CloudPageBlob)blobItem).Name));
Assert.AreEqual(RetryPolicies.LocationMode.PrimaryThenSecondary, ((CloudPageBlob)blobItem).ServiceClient.DefaultRequestOptions.LocationMode);
}
}
finally
Expand Down
24 changes: 24 additions & 0 deletions Test/ClassLibraryCommon/Blob/CloudBlockBlobTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3751,5 +3751,29 @@ private void DoTextUploadDownloadTask(string text, bool checkDifferentEncoding)
}
}
#endif

[TestMethod]
[Description("Test server failure retry case.")]
[TestCategory(ComponentCategory.Blob)]
[TestCategory(TestTypeCategory.UnitTest)]
[TestCategory(SmokeTestCategory.NonSmoke)]
[TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)]
public void CloudBlockBlobFailoverRetry()
{
OperationContext opContext = new OperationContext();
CloudBlobClient badPrimaryClient = new CloudBlobClient(new StorageUri(new Uri("http://1.2.3.4/x//"), new Uri(TargetTenantConfig.BlobServiceSecondaryEndpoint)), TestBase.StorageCredentials);
CloudBlockBlob secondaryBlob = badPrimaryClient.GetContainerReference(GetRandomContainerName()).GetBlockBlobReference("testblob");
badPrimaryClient.DefaultRequestOptions.RetryPolicy = new RetryPolicies.LinearRetry(TimeSpan.Zero, 1);
badPrimaryClient.DefaultRequestOptions.LocationMode = RetryPolicies.LocationMode.PrimaryThenSecondary;
try
{
secondaryBlob.DownloadText(operationContext: opContext);
}
catch (StorageException)
{
Assert.IsTrue(opContext.RequestResults.Count > 1);
Assert.AreEqual(StorageLocation.Secondary, opContext.LastResult.TargetLocation);
}
}
}
}
4 changes: 2 additions & 2 deletions Test/WindowsDesktop/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.2.1.0")]
4 changes: 2 additions & 2 deletions Test/WindowsPhone/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.2.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
4 changes: 2 additions & 2 deletions Test/WindowsPhone81/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.2.1.0")]
[assembly: NeutralResourcesLanguageAttribute("en-US")]
2 changes: 1 addition & 1 deletion Test/WindowsRuntime/Blob/ExceptionHResultTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public async Task CloudBlobUploadTimeoutAsync()
}
catch (Exception e)
{
Assert.AreEqual(WindowsAzureErrorCode.TimeoutException, e.HResult);
Assert.AreEqual(WindowsAzureErrorCode.HttpRequestTimeout, e.HResult);
}
finally
{
Expand Down
2 changes: 1 addition & 1 deletion Test/WindowsRuntime/File/FileExceptionHResultTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public async Task CloudFileUploadTimeoutAsync()
}
catch (Exception e)
{
Assert.AreEqual(WindowsAzureErrorCode.TimeoutException, e.InnerException.InnerException.HResult);
Assert.AreEqual(WindowsAzureErrorCode.HttpRequestTimeout, e.InnerException.InnerException.HResult);
}
finally
{
Expand Down
4 changes: 2 additions & 2 deletions Test/WindowsRuntime/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.0.0")]
[assembly: AssemblyFileVersion("4.2.0.0")]
[assembly: AssemblyVersion("4.2.1.0")]
[assembly: AssemblyFileVersion("4.2.1.0")]
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Changes in 4.2.1 :

- All: Fixed a bug where a TimeoutException was not properly retried.
- All: Fixed a bug where the IngressBytes of a RequestResult was not properly set in the exception case.
- All: Fixed a bug where default request options were overwritten on the resulting objects returned from a ListBlobs call.

Changes in 4.2.0 :

- All: Added the NameValidator class which contains helpers that check to see if resource names are valid.
Expand Down

0 comments on commit 62c2b90

Please sign in to comment.