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 #39 from veena-udayabhanu/master
Browse files Browse the repository at this point in the history
Version 3.1.0.1
  • Loading branch information
Serdar Ozler committed Apr 2, 2014
2 parents 48f8519 + 23d98b3 commit f66dcd9
Show file tree
Hide file tree
Showing 20 changed files with 276 additions and 29 deletions.
4 changes: 3 additions & 1 deletion Lib/Common/Blob/CloudBlobContainer.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ internal CloudBlobContainer(BlobContainerProperties properties, IDictionary<stri
{
this.StorageUri = NavigationHelper.AppendPathToUri(serviceClient.StorageUri, containerName);
this.ServiceClient = serviceClient;
this.Name = containerName;

// Set the relativized name from the URI.
this.Name = NavigationHelper.GetContainerNameFromContainerAddress(this.Uri, this.ServiceClient.UsePathStyleUris);
this.Metadata = metadata;
this.Properties = properties;
}
Expand Down
4 changes: 3 additions & 1 deletion Lib/Common/Blob/CloudBlockBlob.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,10 @@ internal CloudBlockBlob(string blobName, DateTimeOffset? snapshotTime, CloudBlob

this.attributes = new BlobAttributes();
this.attributes.StorageUri = NavigationHelper.AppendPathToUri(container.StorageUri, blobName);
this.Name = blobName;
this.ServiceClient = container.ServiceClient;

// Set the relativized name from the URI.
this.Name = NavigationHelper.GetBlobName(this.attributes.Uri, this.ServiceClient.UsePathStyleUris);
this.container = container;
this.SnapshotTime = snapshotTime;
this.Properties.BlobType = BlobType.BlockBlob;
Expand Down
4 changes: 3 additions & 1 deletion Lib/Common/Blob/CloudPageBlob.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,10 @@ internal CloudPageBlob(string blobName, DateTimeOffset? snapshotTime, CloudBlobC

this.attributes = new BlobAttributes();
this.attributes.StorageUri = NavigationHelper.AppendPathToUri(container.StorageUri, blobName);
this.Name = blobName;
this.ServiceClient = container.ServiceClient;

// Set the relativized name from the URI.
this.Name = NavigationHelper.GetBlobName(this.attributes.Uri, this.ServiceClient.UsePathStyleUris);
this.container = container;
this.SnapshotTime = snapshotTime;
this.Properties.BlobType = BlobType.PageBlob;
Expand Down
15 changes: 14 additions & 1 deletion Lib/Common/Queue/CloudQueue.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ internal CloudQueue(string queueName, CloudQueueClient serviceClient)
{
this.StorageUri = NavigationHelper.AppendPathToUri(serviceClient.StorageUri, queueName);
this.ServiceClient = serviceClient;
this.Name = queueName;

// Set the relativized name from the URI.
this.Name = NavigationHelper.GetQueueNameFromUri(this.Uri, this.ServiceClient.UsePathStyleUris); ;
this.Metadata = new Dictionary<string, string>();
this.EncodeMessage = true;
}
Expand Down Expand Up @@ -244,6 +246,17 @@ private CloudQueueMessage SelectPeekMessageResponse(QueueMessage protocolMessage
return message;
}

/// <summary>
/// Returns a shared access signature for the queue.
/// </summary>
/// <param name="policy">A <see cref="SharedAccessQueuePolicy"/> object specifying the access policy for the shared access signature.</param>
/// <returns>A shared access signature, as a URI query string.</returns>
/// <remarks>The query string returned includes the leading question mark.</remarks>
public string GetSharedAccessSignature(SharedAccessQueuePolicy policy)
{
return this.GetSharedAccessSignature(policy, null /* accessPolicyIdentifier */, null /* sasVersion */);
}

/// <summary>
/// Returns a shared access signature for the queue.
/// </summary>
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 @@ -709,7 +709,7 @@ static HeaderConstants()
/// <summary>
/// Specifies the value to use for UserAgent header.
/// </summary>
public const string UserAgentProductVersion = "3.1.0";
public const string UserAgentProductVersion = "3.1.0.1";

/// <summary>
/// Master Windows Azure Storage header prefix.
Expand Down
43 changes: 42 additions & 1 deletion Lib/Common/Table/CloudTable.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,11 @@ internal CloudTable(string tableName, CloudTableClient client)
{
CommonUtility.AssertNotNull("tableName", tableName);
CommonUtility.AssertNotNull("client", client);
this.Name = tableName;
this.StorageUri = NavigationHelper.AppendPathToUri(client.StorageUri, tableName);
this.ServiceClient = client;

// Set the relativized name from the URI.
this.Name = NavigationHelper.GetTableNameFromUri(this.Uri, this.ServiceClient.UsePathStyleUris);
}

/// <summary>
Expand Down Expand Up @@ -113,6 +115,45 @@ public Uri Uri
/// <value>An object of type <see cref="StorageUri"/> containing the table's URIs for both the primary and secondary locations.</value>
public StorageUri StorageUri { get; private set; }

/// <summary>
/// Returns a shared access signature for the table.
/// </summary>
/// <param name="policy">A <see cref="SharedAccessTablePolicy"/> object specifying the access policy for the shared access signature.</param>
/// <returns>A shared access signature, as a URI query string.</returns>
/// <remarks>The query string returned includes the leading question mark.</remarks>
/// <exception cref="InvalidOperationException">Thrown if the current credentials don't support creating a shared access signature.</exception>
public string GetSharedAccessSignature(SharedAccessTablePolicy policy)
{
return this.GetSharedAccessSignature(
policy,
null /* accessPolicyIdentifier */,
null /* startPartitionKey */,
null /* startRowKey */,
null /* endPartitionKey */,
null /* endRowKey */,
null /* sasVersion */);
}

/// <summary>
/// Returns a shared access signature for the table.
/// </summary>
/// <param name="policy">A <see cref="SharedAccessTablePolicy"/> object specifying the access policy for the shared access signature.</param>
/// <param name="accessPolicyIdentifier">A string identifying a stored access policy.</param>
/// <returns>A shared access signature, as a URI query string.</returns>
/// <remarks>The query string returned includes the leading question mark.</remarks>
/// <exception cref="InvalidOperationException">Thrown if the current credentials don't support creating a shared access signature.</exception>
public string GetSharedAccessSignature(SharedAccessTablePolicy policy, string accessPolicyIdentifier)
{
return this.GetSharedAccessSignature(
policy,
accessPolicyIdentifier,
null /* startPartitionKey */,
null /* startRowKey */,
null /* endPartitionKey */,
null /* endRowKey */,
null /* sasVersion */);
}

/// <summary>
/// Returns a shared access signature for the table.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Lib/WindowsAzure.Storage-Preview.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>WindowsAzure.Storage-Preview</id>
<version>3.1.0.0-preview</version>
<version>3.1.0.1-preview</version>
<title>Windows Azure Storage</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
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("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.0.1")]
[assembly: AssemblyFileVersion("3.1.0.1")]

#if SIGN
[assembly: InternalsVisibleTo(
Expand Down
3 changes: 1 addition & 2 deletions 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>3.1.0.0</version>
<version>3.1.0.1</version>
<title>Windows Azure Storage</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand All @@ -25,7 +25,6 @@ Windows Azure Storage team's blog - http://blogs.msdn.com/b/windowsazurestorage/
<frameworkAssembly assemblyName="System.Data" targetFramework="" />
<frameworkAssembly assemblyName="System.Xml" targetFramework="" />
<frameworkAssembly assemblyName="System.Xml.Linq" targetFramework="" />
<frameworkAssembly assemblyName="System.Data.Services.Client" targetFramework="" />
</frameworkAssemblies>
<references>
<reference file="Microsoft.WindowsAzure.Storage.dll" />
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("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.0.1")]
[assembly: AssemblyFileVersion("3.1.0.1")]
[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("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.0.1")]
[assembly: AssemblyFileVersion("3.1.0.1")]
[assembly: ComVisible(false)]

#if SIGN
Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsRuntimeTable/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("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyVersion("3.1.0.1")]
[assembly: AssemblyFileVersion("3.1.0.1")]
[assembly: ComVisible(false)]

#if SIGN
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>WindowsAzure.Storage.Table-Preview</id>
<version>3.1.0.0-preview</version>
<version>3.1.0.1-preview</version>
<title>Windows Azure Storage Tables Extension for Windows Runtime</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand All @@ -16,7 +16,7 @@ Windows Azure Storage team's blog - http://blogs.msdn.com/b/windowsazurestorage/
<summary>A table extension library for Windows Runtime for working with Windows Azure Storage tables.</summary>
<tags>Microsoft, Azure, Storage, Table, Scalable, winrt, windowsazureofficial</tags>
<dependencies>
<dependency id="WindowsAzure.Storage-Preview" version="3.1.0.0-preview" />
<dependency id="WindowsAzure.Storage-Preview" version="3.1.0.1-preview" />
</dependencies>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Xml" targetFramework="" />
Expand Down
109 changes: 109 additions & 0 deletions Test/ClassLibraryCommon/Blob/SASTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,41 @@ private static void TestBlobSAS(ICloudBlob testBlob, SharedAccessBlobPermissions
TestAccess(sasToken, permissions, headers, null, testBlob);
}

[TestMethod]
[Description("Test SAS with absolute Uri")]
[TestCategory(ComponentCategory.Blob)]
[TestCategory(TestTypeCategory.UnitTest)]
[TestCategory(SmokeTestCategory.NonSmoke)]
[TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)]
public void CloudBlobContainerSASWithAbsoluteUri()
{
CloudBlobClient blobClient = GenerateCloudBlobClient();

CloudBlobContainer container = blobClient.GetContainerReference(blobClient.BaseUri + GetRandomContainerName());
try
{
container.CreateIfNotExists();

SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy()
{
Permissions = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write,
SharedAccessStartTime = DateTimeOffset.UtcNow.AddMinutes(-5),
SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(10)
};

string sasToken = container.GetSharedAccessSignature(policy);
StorageCredentials creds = new StorageCredentials(sasToken);

CloudBlobContainer sasContainer = new CloudBlobContainer(container.Uri, creds);
CloudBlockBlob testBlockBlob = sasContainer.GetBlockBlobReference("blockblob");
UploadText(testBlockBlob, "blob", Encoding.UTF8);
}
finally
{
container.DeleteIfExists();
}
}

[TestMethod]
[Description("Test updateSASToken")]
[TestCategory(ComponentCategory.Blob)]
Expand Down Expand Up @@ -556,5 +591,79 @@ public void CloudPageBlobHeaders20120212SASVersion()
Assert.AreEqual(SR.InvalidHeaders, e.Message);
}
}

[TestMethod]
[Description("Test SAS with absolute Uri")]
[TestCategory(ComponentCategory.Blob)]
[TestCategory(TestTypeCategory.UnitTest)]
[TestCategory(SmokeTestCategory.NonSmoke)]
[TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)]
public void CloudBlockBlobSASWithAbsoluteUri()
{
CloudBlobClient blobClient = GenerateCloudBlobClient();

CloudBlobContainer container = GetRandomContainerReference();
try
{
container.CreateIfNotExists();

CloudBlockBlob testBlockBlob = container.GetBlockBlobReference(container.Uri + "/" + "blockblob");
UploadText(testBlockBlob, "text", Encoding.UTF8);

SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy()
{
Permissions = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write,
SharedAccessStartTime = DateTimeOffset.UtcNow.AddMinutes(-5),
SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(10)
};

string sasToken = testBlockBlob.GetSharedAccessSignature(policy);
StorageCredentials creds = new StorageCredentials(sasToken);

CloudBlockBlob sasBlockBlob = new CloudBlockBlob(testBlockBlob.Uri, creds);
UploadText(sasBlockBlob, "new text", Encoding.UTF8);
}
finally
{
container.DeleteIfExists();
}
}

[TestMethod]
[Description("Test SAS with absolute Uri")]
[TestCategory(ComponentCategory.Blob)]
[TestCategory(TestTypeCategory.UnitTest)]
[TestCategory(SmokeTestCategory.NonSmoke)]
[TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)]
public void CloudPageBlobSASWithAbsoluteUri()
{
CloudBlobClient blobClient = GenerateCloudBlobClient();

CloudBlobContainer container = GetRandomContainerReference();
try
{
container.CreateIfNotExists();

CloudPageBlob testPageBlob = container.GetPageBlobReference(container.Uri + "/" + "pageblob");
UploadText(testPageBlob, "text", Encoding.UTF8);

SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy()
{
Permissions = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write,
SharedAccessStartTime = DateTimeOffset.UtcNow.AddMinutes(-5),
SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(10)
};

string sasToken = testPageBlob.GetSharedAccessSignature(policy);
StorageCredentials creds = new StorageCredentials(sasToken);

CloudPageBlob sasPageBlob = new CloudPageBlob(testPageBlob.Uri, creds);
UploadText(sasPageBlob, "new text", Encoding.UTF8);
}
finally
{
container.DeleteIfExists();
}
}
}
}
34 changes: 34 additions & 0 deletions Test/ClassLibraryCommon/Queue/CloudQueueTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1518,6 +1518,40 @@ public void CloudQueueOldSASVersion()
}
}

[TestMethod]
[Description("Test SAS with absolute Uri")]
[TestCategory(ComponentCategory.Blob)]
[TestCategory(TestTypeCategory.UnitTest)]
[TestCategory(SmokeTestCategory.NonSmoke)]
[TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)]
public void CloudQueueSASWithAbsoluteUri()
{
CloudQueueClient queueClient = GenerateCloudQueueClient();

CloudQueue queue = queueClient.GetQueueReference(queueClient.BaseUri + GenerateNewQueueName());
try
{
queue.CreateIfNotExists();

SharedAccessQueuePolicy policy = new SharedAccessQueuePolicy()
{
Permissions = SharedAccessQueuePermissions.Read,
SharedAccessStartTime = DateTimeOffset.UtcNow.AddMinutes(-5),
SharedAccessExpiryTime = DateTimeOffset.UtcNow.AddMinutes(10)
};

string sasToken = queue.GetSharedAccessSignature(policy);
StorageCredentials creds = new StorageCredentials(sasToken);

CloudQueue sasQueue = new CloudQueue(queue.Uri, creds);
sasQueue.PeekMessage();
}
finally
{
queue.DeleteIfExists();
}
}

#region Test Helpers
internal static void AssertPermissionsEqual(QueuePermissions permissions1, QueuePermissions permissions2)
{
Expand Down
Loading

0 comments on commit f66dcd9

Please sign in to comment.