Skip to content

Commit

Permalink
Update code to use new C# SDKs (#177)
Browse files Browse the repository at this point in the history
* Update Edge code to use new C# SDKs

* Fix byteBufferConverter

* fix duplicate read

* Removing memory stream
  • Loading branch information
varunpuranik authored Aug 18, 2018
1 parent 00fe0d6 commit dfc72b5
Show file tree
Hide file tree
Showing 13 changed files with 30 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices" Version="1.16.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.18.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Amqp" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.16.0" />
<PackageReference Include="Microsoft.Azure.Amqp" Version="2.3.2" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.17.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\edge-util\src\Microsoft.Azure.Devices.Edge.Util\Microsoft.Azure.Devices.Edge.Util.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices" Version="1.16.0" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.17.0" />
<PackageReference Include="Stateless" Version="4.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
<ItemGroup>
<PackageReference Include="App.Metrics" Version="3.0.0-alpha-0780" />
<PackageReference Include="JetBrains.Annotations" Version="11.1.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.17.0" />
<PackageReference Include="System.ValueTuple" Version="4.4.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.18.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.1.1" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.16.0" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.17.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ public byte[] ToByteArray(IByteBuffer byteBuffer)
return new byte[0];
}

int readableBytes = byteBuffer.ReadableBytes;
using (var stream = new ReadOnlyByteBufferStream(byteBuffer, false))
{
var memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
byte[] bytes = memoryStream.ToArray();
var bytes = new byte[readableBytes];
stream.Read(bytes, 0, readableBytes);
return bytes;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,22 @@ static IEnumerable<object[]> GetInvalidTestByteBuffer()
static IEnumerable<object[]> GetTestByteArrays()
{
var rand = new Random();

var bytes = new byte[100];
rand.NextBytes(bytes);
yield return new object[] { bytes };

bytes = new byte[200];
rand.NextBytes(bytes);
yield return new object[] { bytes };

bytes = new byte[20];
rand.NextBytes(bytes);
yield return new object[] { bytes };

bytes = new byte[64];
rand.NextBytes(bytes);
yield return new object[] { bytes };
}

[Theory]
Expand Down
2 changes: 1 addition & 1 deletion edge-modules/MessagesAnalyzer/MessagesAnalyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="2.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.1.1" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.16.0" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.EventHubs" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.18.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.1" />
Expand Down
2 changes: 1 addition & 1 deletion edge-modules/TemperatureFilter/TemperatureFilter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.18.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.1.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.18.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.0-beta3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion edge-modules/load-gen/load-gen.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.Devices.Client" Version="1.18.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="2.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.1.1" />
Expand Down
2 changes: 1 addition & 1 deletion smoke/IotEdgeQuickstart/IotEdgeQuickstart.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

<ItemGroup>
<PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.0-*" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.16.0" />
<PackageReference Include="Microsoft.Azure.Devices" Version="1.17.0" />
<PackageReference Include="Microsoft.Azure.EventHubs" Version="1.1.0" />
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.3" />
<PackageReference Include="RunProcessAsTask" Version="1.2.3" />
Expand Down

0 comments on commit dfc72b5

Please sign in to comment.