Permalink
Browse files

Merge pull request #147 from sozler/dev

Dev
  • Loading branch information...
2 parents cdceb40 + 385bc6c commit dd536fbf0283d3d5bc7b96d58a58af7544a28054 Abdelrahman Elogeel committed Dec 17, 2012
Showing with 877 additions and 123 deletions.
  1. +1 −1 microsoft-azure-api/Services/Storage/Lib/Common/Core/NullType.cs
  2. +39 −3 microsoft-azure-api/Services/Storage/Lib/Common/Queue/CloudQueueMessageBase.cs
  3. +4 −0 microsoft-azure-api/Services/Storage/Lib/Common/Queue/Protocol/QueueMessage.cs
  4. +1 −1 microsoft-azure-api/Services/Storage/Lib/Common/Shared/Protocol/Constants.cs
  5. +4 −4 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableEntity.cs
  6. +5 −2 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableQueryBase.cs
  7. +5 −2 microsoft-azure-api/Services/Storage/Lib/Common/Table/TableQueryGenericBase.cs
  8. +1 −1 microsoft-azure-api/Services/Storage/Lib/DotNet40/Properties/AssemblyInfo.cs
  9. +1 −1 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/CloudTableClient.cs
  10. +1 −0 microsoft-azure-api/Services/Storage/Lib/DotNet40/Table/TableBatchOperation.cs
  11. +5 −1 microsoft-azure-api/Services/Storage/Lib/DotNetCommon/Blob/BlobWriteStream.cs
  12. +44 −5 microsoft-azure-api/Services/Storage/Lib/DotNetCommon/Core/Util/NativeMD5.cs
  13. +6 −6 microsoft-azure-api/Services/Storage/Lib/DotNetCommon/Queue/CloudQueue.cs
  14. +5 −1 microsoft-azure-api/Services/Storage/Lib/RT/Blob/BlobWriteStream.cs
  15. +2 −13 microsoft-azure-api/Services/Storage/Lib/RT/Properties/AssemblyInfo.cs
  16. +1 −0 microsoft-azure-api/Services/Storage/Lib/RT/Table/TableBatchOperation.cs
  17. +1 −1 microsoft-azure-api/Services/Storage/Lib/RTTable/Properties/AssemblyInfo.cs
  18. +1 −1 microsoft-azure-api/Services/Storage/Test/Unit/DotNet40/Properties/AssemblyInfo.cs
  19. +4 −4 microsoft-azure-api/Services/Storage/Test/Unit/DotNet40/Table/Entities/ComplexEntity.cs
  20. +40 −1 microsoft-azure-api/Services/Storage/Test/Unit/DotNet40/Table/TableBatchOperationTest.cs
  21. +37 −1 microsoft-azure-api/Services/Storage/Test/Unit/DotNet40/Table/TableOperationUnitTests.cs
  22. +2 −2 microsoft-azure-api/Services/Storage/Test/Unit/DotNet40/Table/TableQueryGenericTests.cs
  23. +2 −2 microsoft-azure-api/Services/Storage/Test/Unit/DotNet40/Table/TableQueryTests.cs
  24. +4 −4 microsoft-azure-api/Services/Storage/Test/Unit/DotNet40/Table/TableRetryTests.cs
  25. +199 −0 microsoft-azure-api/Services/Storage/Test/Unit/DotNetCommon/Core/AsyncStreamCopierTests.cs
  26. +236 −0 microsoft-azure-api/Services/Storage/Test/Unit/DotNetCommon/Core/DataValidationStream.cs
  27. +57 −47 microsoft-azure-api/Services/Storage/Test/Unit/DotNetCommon/Core/MD5WrapperTests.cs
  28. +130 −0 microsoft-azure-api/Services/Storage/Test/Unit/DotNetCommon/Table/CloudTableClientTests.cs
  29. +2 −3 ...ft-azure-api/Services/Storage/Test/Unit/DotNetCommon/Table/DataServices/Entities/ComplexEntity.cs
  30. +4 −4 microsoft-azure-api/Services/Storage/Test/Unit/DotNetCommon/Table/DataServices/TableRetryTests.cs
  31. +1 −1 microsoft-azure-api/Services/Storage/Test/Unit/RT/Properties/AssemblyInfo.cs
  32. +4 −4 microsoft-azure-api/Services/Storage/Test/Unit/RT/Table/Entities/ComplexEntity.cs
  33. +2 −3 microsoft-azure-api/Services/Storage/Test/Unit/RT/Table/TableEntitySerializationTests.cs
  34. +2 −2 microsoft-azure-api/Services/Storage/Test/Unit/RT/Table/TableQueryGenericTests.cs
  35. +2 −2 microsoft-azure-api/Services/Storage/Test/Unit/RT/Table/TableQueryTests.cs
  36. +22 −0 microsoft-azure-api/Services/Storage/changelog.txt
@@ -20,7 +20,7 @@ namespace Microsoft.WindowsAzure.Storage.Core
/// <summary>
/// A NullTaskReturn type.
/// </summary>
- public class NullType
+ public sealed class NullType
{
/// <summary>
/// Represents a no-return from a task.
@@ -31,17 +31,53 @@ public sealed partial class CloudQueueMessage
/// <summary>
/// The maximum message size in bytes.
/// </summary>
- internal static readonly long MaxMessageSize = 64 * Constants.KB;
+ private const long MaximumMessageSize = 64 * Constants.KB;
+
+ /// <summary>
+ /// Gets the maximum message size in bytes.
+ /// </summary>
+ /// <value>The maximum message size in bytes.</value>
+ public static long MaxMessageSize
+ {
+ get
+ {
+ return MaximumMessageSize;
+ }
+ }
/// <summary>
/// The maximum amount of time a message is kept in the queue.
/// </summary>
- internal static readonly TimeSpan MaxTimeToLive = TimeSpan.FromDays(7);
+ private static readonly TimeSpan MaximumTimeToLive = TimeSpan.FromDays(7);
+
+ /// <summary>
+ /// Gets the maximum amount of time a message is kept in the queue.
+ /// </summary>
+ /// <value>The maximum amount of time a message is kept in the queue.</value>
+ public static TimeSpan MaxTimeToLive
+ {
+ get
+ {
+ return MaximumTimeToLive;
+ }
+ }
/// <summary>
/// The maximum number of messages that can be peeked at a time.
/// </summary>
- internal static readonly int MaxNumberOfMessagesToPeek = 32;
+ private const int MaximumNumberOfMessagesToPeek = 32;
+
+ /// <summary>
+ /// Gets the maximum number of messages that can be peeked at a time.
+ /// </summary>
+ /// <value>The maximum number of messages that can be peeked at a time.</value>
+ public static int MaxNumberOfMessagesToPeek
+ {
+ get
+ {
+ return MaximumNumberOfMessagesToPeek;
+ }
+ }
/// <summary>
/// Custom UTF8Encoder to throw exception in case of invalid bytes.
@@ -22,7 +22,11 @@ namespace Microsoft.WindowsAzure.Storage.Queue.Protocol
/// <summary>
/// Represents a message retrieved from a queue.
/// </summary>
+#if !RTMD
public class QueueMessage
+#else
+ internal class QueueMessage
+#endif
{
/// <summary>
/// Initializes a new instance of the <see cref="QueueMessage"/> class.
@@ -605,7 +605,7 @@ internal class HeaderConstants
/// <summary>
/// Specifies the value to use for UserAgent header.
/// </summary>
- public const string UserAgentProductVersion = "2.0.2";
+ public const string UserAgentProductVersion = "2.0.3";
/// <summary>
/// Master Windows Azure Storage header prefix.
@@ -140,7 +140,7 @@ public virtual void ReadEntity(IDictionary<string, EntityProperty> properties, O
property.SetValue(this, entityProperty.BinaryValue, null);
break;
case EdmType.Boolean:
- if (property.PropertyType != typeof(bool) && property.PropertyType != typeof(Boolean))
+ if (property.PropertyType != typeof(bool) && property.PropertyType != typeof(Boolean) && property.PropertyType != typeof(Boolean?) && property.PropertyType != typeof(bool?))
{
continue;
}
@@ -167,7 +167,7 @@ public virtual void ReadEntity(IDictionary<string, EntityProperty> properties, O
break;
case EdmType.Double:
- if (property.PropertyType != typeof(double) && property.PropertyType != typeof(Double))
+ if (property.PropertyType != typeof(double) && property.PropertyType != typeof(Double) && property.PropertyType != typeof(Double?) && property.PropertyType != typeof(double?))
{
continue;
}
@@ -183,15 +183,15 @@ public virtual void ReadEntity(IDictionary<string, EntityProperty> properties, O
property.SetValue(this, entityProperty.GuidValue, null);
break;
case EdmType.Int32:
- if (property.PropertyType != typeof(int) && property.PropertyType != typeof(Int32))
+ if (property.PropertyType != typeof(int) && property.PropertyType != typeof(Int32) && property.PropertyType != typeof(Int32?) && property.PropertyType != typeof(int?))
{
continue;
}
property.SetValue(this, entityProperty.Int32Value, null);
break;
case EdmType.Int64:
- if (property.PropertyType != typeof(long) && property.PropertyType != typeof(Int64))
+ if (property.PropertyType != typeof(long) && property.PropertyType != typeof(Int64) && property.PropertyType != typeof(long?) && property.PropertyType != typeof(Int64?))
{
continue;
}
@@ -164,11 +164,14 @@ private static string GenerateFilterCondition(string propertyName, string operat
{
string valueOperand = null;
- if (edmType == EdmType.Boolean || edmType == EdmType.Double || edmType == EdmType.Int32
- || edmType == EdmType.Int64)
+ if (edmType == EdmType.Boolean || edmType == EdmType.Double || edmType == EdmType.Int32)
{
valueOperand = givenValue;
}
+ else if (edmType == EdmType.Int64)
+ {
+ valueOperand = string.Format("{0}L", givenValue);
+ }
else if (edmType == EdmType.DateTime)
{
valueOperand = string.Format("datetime'{0}'", givenValue);
@@ -162,11 +162,14 @@ private static string GenerateFilterCondition(string propertyName, string operat
{
string valueOperand = null;
- if (edmType == EdmType.Boolean || edmType == EdmType.Double || edmType == EdmType.Int32
- || edmType == EdmType.Int64)
+ if (edmType == EdmType.Boolean || edmType == EdmType.Double || edmType == EdmType.Int32)
{
valueOperand = value;
}
+ else if (edmType == EdmType.Int64)
+ {
+ valueOperand = string.Format("{0}L", value);
+ }
else if (edmType == EdmType.DateTime)
{
valueOperand = string.Format("datetime'{0}'", value);
@@ -36,7 +36,7 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.2.0")]
+[assembly: AssemblyFileVersion("2.0.3.0")]
#if SIGNED
[assembly: InternalsVisibleTo(
@@ -140,7 +140,7 @@ public ICancellableAsyncResult BeginListTablesSegmented(string prefix, TableCont
Justification = "This is a member-operation.")]
public TableResultSegment EndListTablesSegmented(IAsyncResult asyncResult)
{
- ResultSegment<DynamicTableEntity> res = Executor.EndExecuteAsync<ResultSegment<DynamicTableEntity>>(asyncResult);
+ TableQuerySegment<DynamicTableEntity> res = Executor.EndExecuteAsync<TableQuerySegment<DynamicTableEntity>>(asyncResult);
List<CloudTable> tables = res.Results.Select(tbl => new CloudTable(
NavigationHelper.AppendPathToUri(this.BaseUri, tbl.Properties[TableConstants.TableName].StringValue),
@@ -124,6 +124,7 @@ private static RESTCommand<IList<TableResult>> BatchImpl(TableBatchOperation bat
batchCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Accepted, resp != null ? resp.StatusCode : HttpStatusCode.Unused, results, cmd, ex, ctx);
batchCmd.PostProcessResponse = (cmd, resp, ex, ctx) => TableOperationHttpResponseParsers.TableBatchOperationPostProcess(results, batch, cmd, resp, ctx);
+ batchCmd.RecoveryAction = (cmd, ex, ctx) => results.Clear();
return batchCmd;
}
@@ -192,8 +192,12 @@ public override void Flush()
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
protected override void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ this.Commit();
+ }
+
base.Dispose(disposing);
- this.Commit();
}
/// <summary>
@@ -61,17 +61,27 @@ internal class NativeMD5 : IDisposable
/// </summary>
private IntPtr hashProv;
+ /// <summary>
+ /// Whether this object has been torn down or not.
+ /// </summary>
+ private bool disposed = false;
+
private NativeMD5()
{
- if (this.hashProv == IntPtr.Zero)
- {
- this.ValidateReturnCode(CryptAcquireContext(out this.hashProv, null, null, ProvRsaFull, CryptVerifyContext));
- }
+ this.ValidateReturnCode(CryptAcquireContext(out this.hashProv, null, null, ProvRsaFull, CryptVerifyContext));
this.ValidateReturnCode(CryptCreateHash(this.hashProv, CalgMD5, IntPtr.Zero, 0, out this.hashHandle));
}
/// <summary>
+ /// Finalizes an instance of the NativeMD5 class, unhooking it from all events.
+ /// </summary>
+ ~NativeMD5()
+ {
+ this.DisposeUnmanagedResources();
+ }
+
+ /// <summary>
/// Create a Fisma hash.
/// </summary>
public static NativeMD5 Create()
@@ -143,7 +153,30 @@ public void ValidateReturnCode(bool status)
/// </summary>
public void Dispose()
{
- this.ValidateReturnCode(CryptDestroyHash(this.hashHandle));
+ if (!this.disposed)
+ {
+ this.DisposeUnmanagedResources();
+ this.disposed = true;
+ GC.SuppressFinalize(this);
+ }
+ }
+
+ /// <summary>
+ /// Releases the unmanaged resources.
+ /// </summary>
+ public void DisposeUnmanagedResources()
+ {
+ if (this.hashHandle != IntPtr.Zero)
+ {
+ CryptDestroyHash(this.hashHandle);
+ this.hashHandle = IntPtr.Zero;
+ }
+
+ if (this.hashProv != IntPtr.Zero)
+ {
+ CryptReleaseContext(this.hashProv, 0);
+ this.hashProv = IntPtr.Zero;
+ }
}
[DllImport("advapi32.dll", CharSet = CharSet.Auto, SetLastError = true)]
@@ -160,6 +193,12 @@ public void Dispose()
private static extern bool CryptDestroyHash(
IntPtr hashHandle);
+ [DllImport("advapi32.dll")]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool CryptReleaseContext(
+ IntPtr hashProv,
+ Int32 dwFlags); // Reserved. Must be 0.
+
[DllImport("advapi32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool CryptGetHashParam(
@@ -158,13 +158,13 @@ public ICancellableAsyncResult BeginCreateIfNotExists(QueueRequestOptions option
OperationContext = operationContext,
};
- operationContext.OperationExpiryTime = options.MaximumExecutionTime.HasValue
- ? DateTime.Now + options.MaximumExecutionTime.Value
+ operationContext.OperationExpiryTime = modifiedOptions.MaximumExecutionTime.HasValue
+ ? DateTime.Now + modifiedOptions.MaximumExecutionTime.Value
: (DateTime?)null;
lock (chainedResult.CancellationLockerObject)
{
- ICancellableAsyncResult currentRes = this.BeginExists(options, operationContext, this.CreateIfNotExistsHandler, chainedResult);
+ ICancellableAsyncResult currentRes = this.BeginExists(modifiedOptions, operationContext, this.CreateIfNotExistsHandler, chainedResult);
chainedResult.CancelDelegate = currentRes.Cancel;
// Check if cancellation was requested prior to begin
@@ -318,13 +318,13 @@ public ICancellableAsyncResult BeginDeleteIfExists(QueueRequestOptions options,
OperationContext = operationContext,
};
- operationContext.OperationExpiryTime = options.MaximumExecutionTime.HasValue
- ? DateTime.Now + options.MaximumExecutionTime.Value
+ operationContext.OperationExpiryTime = modifiedOptions.MaximumExecutionTime.HasValue
+ ? DateTime.Now + modifiedOptions.MaximumExecutionTime.Value
: (DateTime?)null;
lock (chainedResult.CancellationLockerObject)
{
- ICancellableAsyncResult currentRes = this.BeginExists(options, operationContext, this.DeleteIfExistsHandler, chainedResult);
+ ICancellableAsyncResult currentRes = this.BeginExists(modifiedOptions, operationContext, this.DeleteIfExistsHandler, chainedResult);
chainedResult.CancelDelegate = currentRes.Cancel;
// Check if cancellation was requested prior to begin
@@ -171,8 +171,12 @@ public override void Flush()
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
protected override void Dispose(bool disposing)
{
+ if (disposing)
+ {
+ this.CommitAsync().Wait();
+ }
+
base.Dispose(disposing);
- this.CommitAsync().Wait();
}
/// <summary>
@@ -25,17 +25,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.2.0")]
+[assembly: AssemblyFileVersion("2.0.3.0")]
[assembly: ComVisible(false)]
-
-#if SIGNED
-[assembly: InternalsVisibleTo(
- "Microsoft.WindowsAzure.Storage.Table, PublicKey=" +
- "0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67" +
- "871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0b" +
- "d333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307" +
- "e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c3" +
- "08055da9")]
-#else
-[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.Storage.Table")]
-#endif
+[assembly: InternalsVisibleTo("Microsoft.WindowsAzure.Storage.Table")]
@@ -66,6 +66,7 @@ private static RESTCommand<IList<TableResult>> BatchImpl(TableBatchOperation bat
batchCmd.BuildRequest = (cmd, cnt, ctx) => TableOperationHttpRequestMessageFactory.BuildRequestForTableBatchOperation(cmd.Uri, cmd.ServerTimeoutInSeconds, client.BaseUri, tableName, batch, ctx);
batchCmd.PreProcessResponse = (cmd, resp, ex, ctx) => HttpResponseParsers.ProcessExpectedStatusCodeNoException(HttpStatusCode.Accepted, resp.StatusCode, results, cmd, ex, ctx);
batchCmd.PostProcessResponse = (cmd, resp, ex, ctx) => TableOperationHttpResponseParsers.TableBatchOperationPostProcess(results, batch, cmd, resp, ctx);
+ batchCmd.RecoveryAction = (cmd, ex, ctx) => results.Clear();
return batchCmd;
}
@@ -25,5 +25,5 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.2.0")]
+[assembly: AssemblyFileVersion("2.0.3.0")]
[assembly: ComVisible(false)]
@@ -33,4 +33,4 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.0.0")]
-[assembly: AssemblyFileVersion("2.0.2.0")]
+[assembly: AssemblyFileVersion("2.0.3.0")]
@@ -256,14 +256,14 @@ public Int32 Int32
set { longPrimitiveNull = value; }
}
- private long? longPrimitiveN = 1234;
+ private long? longPrimitiveN = 123456789012;
public long? LongPrimitiveN
{
get { return longPrimitiveN; }
set { longPrimitiveN = value; }
}
- private long longPrimitive = 1234;
+ private long longPrimitive = 123456789012;
public long LongPrimitive
{
get { return longPrimitive; }
@@ -277,14 +277,14 @@ public long LongPrimitive
set { int64Null = value; }
}
- private Int64? int64N = (long)1234;
+ private Int64? int64N = 123456789012;
public Int64? Int64N
{
get { return int64N; }
set { int64N = value; }
}
- private Int64 int64 = (long)1234;
+ private Int64 int64 = 123456789012;
public Int64 Int64
{
get { return int64; }
Oops, something went wrong.

0 comments on commit dd536fb

Please sign in to comment.