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

Commit

Permalink
[XSCL 3.0.1] - Hotfix changes -part3
Browse files Browse the repository at this point in the history
  • Loading branch information
veena-udayabhanu committed Dec 10, 2013
1 parent 0e77e98 commit 2dc7376
Show file tree
Hide file tree
Showing 15 changed files with 46 additions and 23 deletions.
10 changes: 10 additions & 0 deletions Lib/ClassLibraryCommon/Shared/Protocol/HttpWebRequestFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ internal static HttpWebRequest GetAcl(Uri uri, UriQueryBuilder builder, int? tim
builder.Add(Constants.QueryConstants.Component, "acl");

HttpWebRequest request = CreateWebRequest(WebRequestMethods.Http.Get, uri, timeout, builder, operationContext);

// Windows phone adds */* as the Accept type when we don't set one explicitly.
#if WINDOWS_PHONE
request.Accept = Constants.XMLAcceptHeaderValue;
#endif
return request;
}

Expand All @@ -140,6 +145,11 @@ internal static HttpWebRequest SetAcl(Uri uri, UriQueryBuilder builder, int? tim
builder.Add(Constants.QueryConstants.Component, "acl");

HttpWebRequest request = CreateWebRequest(WebRequestMethods.Http.Put, uri, timeout, builder, operationContext);

// Windows phone adds */* as the Accept type when we don't set one explicitly.
#if WINDOWS_PHONE
request.Accept = Constants.XMLAcceptHeaderValue;
#endif
return request;
}

Expand Down
5 changes: 5 additions & 0 deletions Lib/Common/Shared/Protocol/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,11 @@ static class Constants
/// </summary>
internal const string DefaultTableName = "TableName";

/// <summary>
/// Header value to set Accept to XML.
/// </summary>
internal const string XMLAcceptHeaderValue = "application/xml";

/// <summary>
/// Header value to set Accept to AtomPub.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Test/Common/TestHelper.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ internal static void ValidateResponse(OperationContext opContext, int expectedAt
{
TestHelper.AssertNAttempts(opContext, 1);
Assert.AreEqual(opContext.LastResult.HttpStatusCode, expectedStatusCode);
Assert.IsTrue(allowedErrorCodes.Contains(opContext.LastResult.ExtendedErrorInformation.ErrorCode), "Unexpected Error Code, recieved" + opContext.LastResult.ExtendedErrorInformation.ErrorCode);
Assert.IsTrue(allowedErrorCodes.Contains(opContext.LastResult.ExtendedErrorInformation.ErrorCode), "Unexpected Error Code, received " + opContext.LastResult.ExtendedErrorInformation.ErrorCode);

if (errorMessageBeginsWith != null)
{
Expand Down
4 changes: 4 additions & 0 deletions Test/WindowsPhone/Blob/BlobAnalyticsUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,10 @@ private static ServiceProperties DefaultServiceProperties()
props.HourMetrics.RetentionDays = null;
props.HourMetrics.Version = "1.0";

props.MinuteMetrics.MetricsLevel = MetricsLevel.None;
props.MinuteMetrics.RetentionDays = null;
props.MinuteMetrics.Version = "1.0";

props.DefaultServiceVersion = "2013-08-15";

return props;
Expand Down
1 change: 0 additions & 1 deletion Test/WindowsPhone/Blob/CloudPageBlobTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ public async Task CloudPageBlobFetchAttributesAsync()
Assert.AreEqual(1024, blob2.Properties.Length);
Assert.AreEqual(blob.Properties.ETag, blob2.Properties.ETag);
Assert.AreEqual(blob.Properties.LastModified, blob2.Properties.LastModified);
Assert.IsNull(blob2.Properties.CacheControl);
Assert.IsNull(blob2.Properties.ContentEncoding);
Assert.IsNull(blob2.Properties.ContentLanguage);
Assert.AreEqual("application/octet-stream", blob2.Properties.ContentType);
Expand Down
4 changes: 4 additions & 0 deletions Test/WindowsPhone/Queue/QueueAnalyticsUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,10 @@ private static ServiceProperties DefaultServiceProperties()
props.HourMetrics.RetentionDays = null;
props.HourMetrics.Version = "1.0";

props.MinuteMetrics.MetricsLevel = MetricsLevel.None;
props.MinuteMetrics.RetentionDays = null;
props.MinuteMetrics.Version = "1.0";

return props;
}
#endregion
Expand Down
9 changes: 0 additions & 9 deletions Test/WindowsPhone/Table/CloudTableClientTaskTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,8 @@ private async Task DoListTablesSegmentedBasicAsync(TablePayloadFormat format)
[TestCategory(SmokeTestCategory.NonSmoke)]
[TestCategory(TenantTypeCategory.DevStore), TestCategory(TenantTypeCategory.DevFabric), TestCategory(TenantTypeCategory.Cloud)]
public async Task ListTablesSegmentedMaxResultsAsync()
{
await DoListTablesSegmentedMaxResultsAsync(TablePayloadFormat.Json);
await DoListTablesSegmentedMaxResultsAsync(TablePayloadFormat.JsonNoMetadata);
await DoListTablesSegmentedMaxResultsAsync(TablePayloadFormat.JsonFullMetadata);
await DoListTablesSegmentedMaxResultsAsync(TablePayloadFormat.AtomPub);
}

private async Task DoListTablesSegmentedMaxResultsAsync(TablePayloadFormat format)
{
CloudTableClient tableClient = GenerateCloudTableClient();
tableClient.PayloadFormat = format;
TableResultSegment segment = null;
List<CloudTable> totalResults = new List<CloudTable>();

Expand Down
4 changes: 4 additions & 0 deletions Test/WindowsPhone/Table/TableAnalyticsUnitTaskTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,10 @@ private static ServiceProperties DefaultServiceProperties()
props.HourMetrics.RetentionDays = null;
props.HourMetrics.Version = "1.0";

props.MinuteMetrics.MetricsLevel = MetricsLevel.None;
props.MinuteMetrics.RetentionDays = null;
props.MinuteMetrics.Version = "1.0";

return props;
}
#endregion
Expand Down
4 changes: 2 additions & 2 deletions Test/WindowsPhone/Table/TableOperationUnitTaskTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ private async Task DoTableOperationInsertWithEchoContentAsync(TablePayloadFormat
insertResult = await currentTable.ExecuteAsync(TableOperation.Insert(ent, true));
Assert.AreEqual(HttpStatusCode.Created, (HttpStatusCode)insertResult.HttpStatusCode);

// Default is true.
// Default is false.
ent = new DynamicTableEntity() { PartitionKey = Guid.NewGuid().ToString(), RowKey = DateTime.Now.Ticks.ToString() };
insertResult = await currentTable.ExecuteAsync(TableOperation.Insert(ent));
Assert.AreEqual(HttpStatusCode.Created, (HttpStatusCode)insertResult.HttpStatusCode);
Assert.AreEqual(HttpStatusCode.NoContent, (HttpStatusCode)insertResult.HttpStatusCode);
}

[TestMethod]
Expand Down
2 changes: 2 additions & 0 deletions Test/WindowsRuntime/Blob/CloudBlobClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.RetryPolicies;
using System;
using System.Collections.Generic;
using System.IO;
Expand Down Expand Up @@ -466,6 +467,7 @@ public async Task CloudBlobClientGetServiceStatsAsync()
AssertSecondaryEndpoint();

CloudBlobClient client = GenerateCloudBlobClient();
client.LocationMode = LocationMode.SecondaryOnly;
TestHelper.VerifyServiceStats(await client.GetServiceStatsAsync());
}
}
Expand Down
12 changes: 6 additions & 6 deletions Test/WindowsRuntime/Core/SecondaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@ public async Task LocationModeWithMissingUriAsync()
RetryPolicy = new NoRetry(),
};

StorageException e = await TestHelper.ExpectedExceptionAsync<StorageException>(
Exception e = await TestHelper.ExpectedExceptionAsync<Exception>(
async () => await container.FetchAttributesAsync(null, options, null),
"Request should fail when an URI is not provided for the target location");
Assert.IsInstanceOfType(e.InnerException, typeof(InvalidOperationException));
Assert.IsInstanceOfType(e.InnerException.InnerException, typeof(InvalidOperationException));

options.LocationMode = LocationMode.SecondaryThenPrimary;
e = await TestHelper.ExpectedExceptionAsync<StorageException>(
e = await TestHelper.ExpectedExceptionAsync<Exception>(
async () => await container.FetchAttributesAsync(null, options, null),
"Request should fail when an URI is not provided for the target location");
Assert.IsInstanceOfType(e.InnerException, typeof(InvalidOperationException));
Assert.IsInstanceOfType(e.InnerException.InnerException, typeof(InvalidOperationException));

options.LocationMode = LocationMode.PrimaryThenSecondary;
e = await TestHelper.ExpectedExceptionAsync<StorageException>(
e = await TestHelper.ExpectedExceptionAsync<Exception>(
async () => await container.FetchAttributesAsync(null, options, null),
"Request should fail when an URI is not provided for the target location");
Assert.IsInstanceOfType(e.InnerException, typeof(InvalidOperationException));
Assert.IsInstanceOfType(e.InnerException.InnerException, typeof(InvalidOperationException));
}

[TestMethod]
Expand Down
2 changes: 2 additions & 0 deletions Test/WindowsRuntime/Queue/CloudQueueClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Microsoft.WindowsAzure.Storage.Queue.Protocol;
using Microsoft.WindowsAzure.Storage.RetryPolicies;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -195,6 +196,7 @@ public async Task CloudQueueClientGetServiceStatsAsync()
AssertSecondaryEndpoint();

CloudQueueClient client = GenerateCloudQueueClient();
client.LocationMode = LocationMode.SecondaryOnly;
TestHelper.VerifyServiceStats(await client.GetServiceStatsAsync());
}
}
Expand Down
2 changes: 2 additions & 0 deletions Test/WindowsRuntime/Table/CloudTableClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// -----------------------------------------------------------------------------------------

using Microsoft.VisualStudio.TestPlatform.UnitTestFramework;
using Microsoft.WindowsAzure.Storage.RetryPolicies;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
Expand Down Expand Up @@ -255,6 +256,7 @@ public async Task CloudTableClientGetServiceStatsAsync()
AssertSecondaryEndpoint();

CloudTableClient client = GenerateCloudTableClient();
client.LocationMode = LocationMode.SecondaryOnly;
TestHelper.VerifyServiceStats(await client.GetServiceStatsAsync());
}
}
Expand Down
7 changes: 3 additions & 4 deletions Test/WindowsRuntime/Table/TableBatchOperationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,7 @@ public async Task TableBatchEntityOver1MBShouldThrow()
}
catch (Exception)
{
TestHelper.ValidateResponse(opContext, 1, (int)HttpStatusCode.BadRequest, new string[] { "EntityTooLarge" }, "The entity is larger than allowed by the Table Service.");
TestHelper.ValidateResponse(opContext, 1, (int)HttpStatusCode.BadRequest, new string[] { "EntityTooLarge" }, "The entity is larger than the maximum allowed size (1MB).");
}
}

Expand Down Expand Up @@ -1247,10 +1247,9 @@ public async Task TableBatchOver4MBShouldThrow()
await currentTable.ExecuteBatchAsync(batch, null, opContext);
Assert.Fail();
}

catch (Exception)
{
TestHelper.ValidateResponse(opContext, 1, (int)HttpStatusCode.BadRequest, new string[] { "ContentLengthExceeded" }, "The content length for the requested operation has exceeded the limit.");
TestHelper.ValidateResponse(opContext, 1, (int)HttpStatusCode.RequestEntityTooLarge, new string[] { "RequestBodyTooLarge" }, "The request body is too large and exceeds the maximum permissible limit.");
}
}

Expand Down Expand Up @@ -1416,7 +1415,7 @@ public async Task TableBatchWithPropertyOver255CharsShouldThrow()

catch (Exception)
{
TestHelper.ValidateResponse(opContext, 1, (int)HttpStatusCode.BadRequest, new string[] { "PropertyNameTooLong" }, "The property name exceeds the maximum allowed length.");
TestHelper.ValidateResponse(opContext, 1, (int)HttpStatusCode.BadRequest, new string[] { "PropertyNameTooLong" }, "The property name exceeds the maximum allowed length (255).");
}
}

Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ Issues fixed in 3.0.0.0 :

Issues fixed in 3.0.1.0 :

- All (WP): Set the Accept type to application/xml explicitly for Get/SetACL.
- Blobs: LastModified and ETag properties are populated after Lease operations.
- Tables: Added an explicit reference to Microsoft.Data.Services.Client in the Nuget package.
- Tables: Fixed an issue caused by a Json .NET bug that resulted in an error being thrown while parsing a table query response. More details on the bug can be found here: http://james.newtonking.com/archive/2013/11/29/fixing-jarray-getenumerator-method-not-found-bug
Expand Down

0 comments on commit 2dc7376

Please sign in to comment.