Skip to content

Commit

Permalink
Merge pull request #103 from Azure/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
xinchen10 authored May 9, 2018
2 parents 38b170b + 26462b3 commit 339708e
Show file tree
Hide file tree
Showing 13 changed files with 4,102 additions and 2,871 deletions.
2 changes: 1 addition & 1 deletion Microsoft.Azure.Amqp.Uwp/Microsoft.Azure.Amqp.Uwp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<AssemblyName>Microsoft.Azure.Amqp</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
<TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion>
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
<TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>
<MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>
<FileAlignment>512</FileAlignment>
Expand Down
25 changes: 17 additions & 8 deletions Microsoft.Azure.Amqp/Amqp/AmqpMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,14 @@ public override long SerializedMessageSize
{
get
{
this.EnsureInitialized();
return this.bufferStream.Length;
if (this.bufferStream != null)
{
return this.bufferStream.Length;
}

// Do not cache the result stream
// as the message could be updated again
return this.Initialize().Length;
}
}

Expand All @@ -414,7 +420,7 @@ protected void EnsureInitialized()
{
if (!this.initialized)
{
this.Initialize();
this.bufferStream = this.Initialize();
this.initialized = true;
}
}
Expand All @@ -431,9 +437,12 @@ protected virtual void OnInitialize()

public override Stream ToStream()
{
bool more;
ArraySegment<byte>[] payload = this.GetPayload(int.MaxValue, out more);
return new BufferListStream(payload);
if (this.bufferStream != null)
{
return (Stream)this.bufferStream.Clone();
}

return this.Initialize();
}

protected abstract int GetBodySize();
Expand All @@ -444,7 +453,7 @@ protected virtual void AddCustomSegments(List<ArraySegment<byte>> segmentList)
{
}

void Initialize()
BufferListStream Initialize()
{
this.OnInitialize();

Expand Down Expand Up @@ -494,7 +503,7 @@ void Initialize()
}
}

this.bufferStream = new BufferListStream(segmentList.ToArray());
return new BufferListStream(segmentList.ToArray());
}
}

Expand Down
2 changes: 1 addition & 1 deletion Microsoft.Azure.Amqp/Microsoft.Azure.Amqp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<PackageReference Include="System.Security.Principal" Version="4.0.1" />
<PackageReference Include="System.Threading.Thread" Version="4.0.0" />
<PackageReference Include="System.Threading.ThreadPool" Version="4.0.10" />
<PackageReference Include="System.Net.WebSockets.Client" Version="4.0.0" />
<PackageReference Include="System.Net.WebSockets.Client" Version="4.0.2" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions Microsoft.Azure.Amqp/Properties/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyInformationalVersion("2.2.0")]
[assembly: AssemblyVersion("2.3.0.0")]
[assembly: AssemblyInformationalVersion("2.3.0")]
43 changes: 43 additions & 0 deletions test/Test.Microsoft.Amqp.Android/MainActivity.cs.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Reflection;
using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;

using Xunit.Sdk;
using Xunit.Runners.UI;

namespace Test.Microsoft.Amqp.Android
{
[Activity(Label = "xUnit Android Runner", MainLauncher = true, Theme= "@android:style/Theme.Material.Light")]
public class MainActivity : RunnerActivity
{

protected override void OnCreate(Bundle bundle)
{
// tests can be inside the main assembly
AddTestAssembly(Assembly.GetExecutingAssembly());

AddExecutionAssembly(typeof(ExtensibilityPointFactory).Assembly);
// or in any reference assemblies

//AddTestAssembly(typeof(PortableTests).Assembly);
// or in any assembly that you load (since JIT is available)

#if false
// you can use the default or set your own custom writer (e.g. save to web site and tweet it ;-)
Writer = new TcpTextWriter ("10.0.1.2", 16384);
// start running the test suites as soon as the application is loaded
AutoStart = true;
// crash the application (to ensure it's ended) and return to springboard
TerminateAfterExecution = true;
#endif
// you cannot add more assemblies once calling base
base.OnCreate(bundle);
}
}
}

Loading

0 comments on commit 339708e

Please sign in to comment.