Skip to content
Permalink
Browse files
Merge pull request #4 from michaelandrepearce/netstd2
AMQNET-565 NetStandard 2.0 Build
  • Loading branch information
michaelandrepearce committed Jun 11, 2019
2 parents 8cf76a3 + 2188e3e commit f9a65546b347748f2048a71a01f30ace76f28bf7
Showing 7 changed files with 178 additions and 25 deletions.
@@ -0,0 +1,6 @@

.vs/

bin/
obj/
*.csproj.user
@@ -50,15 +50,9 @@ public override void TearDown()
}

[Test]
[ExpectedException(Handler="ExceptionValidationCheck")]
public void TestBadConsumerException()
{
session.CreateConsumer(null);
}

public void ExceptionValidationCheck(Exception ex)
{
Assert.IsNotNull(ex as NMSException, "Invalid exception was thrown.");
}
}
Assert.Throws<NMSException>(() => session.CreateConsumer(null));
}
}
}
@@ -66,9 +66,13 @@ public void testReadString16_1byteAnd2byteEmbeddedNULLs()
readString16Helper(input, expect);
}

[Test]
[ExpectedException(typeof(IOException))]
public void testReadString16_UTF8Missing2ndByte()
[Test]
public void testReadString16_UTF8Missing2ndByte()
{
Assert.Throws<IOException>(_testReadString16_UTF8Missing2ndByte);
}

private void _testReadString16_UTF8Missing2ndByte()
{
// Test with bad UTF-8 encoding, missing 2nd byte of two byte value
byte[] input = { 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 };
@@ -80,8 +84,12 @@ public void testReadString16_UTF8Missing2ndByte()
}

[Test]
[ExpectedException(typeof(IOException))]
public void testReadString16_3byteEncodingMissingLastByte()
public void testReadString16_3byteEncodingMissingLastByte()
{
Assert.Throws<IOException>(_testReadString16_3byteEncodingMissingLastByte);
}

private void _testReadString16_3byteEncodingMissingLastByte()
{
// Test with three byte encode that's missing a last byte.
byte[] input = { 0x00, 0x02, 0xE8, 0xA8 };
@@ -134,12 +142,17 @@ public void testReadString32_1byteAnd2byteEmbeddedNULLs()
readString32Helper(input, expect);
}

[Test]
[ExpectedException(typeof(IOException))]
public void testReadString32_UTF8Missing2ndByte()
[Test]
public void testReadString32_UTF8Missing2ndByte()
{
Assert.Throws<IOException>(_testReadString32_UTF8Missing2ndByte);
}

private void _testReadString32_UTF8Missing2ndByte()
{
// Test with bad UTF-8 encoding, missing 2nd byte of two byte value
byte[] input = { 0x00, 0x00, 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 };

// Test with bad UTF-8 encoding, missing 2nd byte of two byte value
byte[] input = { 0x00, 0x00, 0x00, 0x0D, 0xC0, 0x80, 0x04, 0xC3, 0x82, 0xC2, 0xC2, 0xC3, 0x83, 0xC0, 0x80, 0xC2, 0xA6 };

MemoryStream stream = new MemoryStream(input);
EndianBinaryReader reader = new EndianBinaryReader(stream);
@@ -148,8 +161,12 @@ public void testReadString32_UTF8Missing2ndByte()
}

[Test]
[ExpectedException(typeof(IOException))]
public void testReadString32_3byteEncodingMissingLastByte()
public void testReadString32_3byteEncodingMissingLastByte()
{
Assert.Throws<IOException>(_testReadString32_3byteEncodingMissingLastByte);
}

private void _testReadString32_3byteEncodingMissingLastByte()
{
// Test with three byte encode that's missing a last byte.
byte[] input = { 0x00, 0x00, 0x00, 0x02, 0xE8, 0xA8 };
@@ -99,8 +99,12 @@ public void testWriteString16_emptystring()
}

[Test]
[ExpectedException(typeof(IOException))]
public void testWriteString16_stringTooLong()
public void testWriteString16_stringTooLong()
{
Assert.Throws<IOException>(_testWriteString16_stringTooLong);
}

private void _testWriteString16_stringTooLong()
{
// String of length 65536 of Null Characters.
MemoryStream stream = new MemoryStream();
@@ -120,8 +124,12 @@ public void testWriteString16_maxStringLength()
}

[Test]
[ExpectedException(typeof(IOException))]
public void testWriteString16_invalidEncodingHeader()
public void testWriteString16_invalidEncodingHeader()
{
Assert.Throws<IOException>(_testWriteString16_invalidEncodingHeader);
}

private void _testWriteString16_invalidEncodingHeader()
{
// Set one of the 65535 bytes to a value that will result in a 2 byte UTF8 encoded sequence.
// This will cause the string of length 65535 to have a utf length of 65536.
@@ -0,0 +1,51 @@
<Project>
<PropertyGroup>
<MSBuildProjectExtensionsPath>obj\$(MSBuildProjectName)</MSBuildProjectExtensionsPath>
<BaseIntermediateOutputPath>obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Apache.NMS.Test</PackageId>
<Version>1.8.0</Version>
<Authors>Apache ActiveMQ</Authors>
<Company>Apache Software Foundation</Company>
<Product>Apache NMS API</Product>
<Description>Apache NMS (.Net Standard Messaging Library) Test Suite</Description>
<Copyright>Copyright (C) 2005-2019 Apache Software Foundation</Copyright>
<PackageProjectUrl>https://activemq.apache.org/components/nms/</PackageProjectUrl>
<PackageLicense>https://github.com/apache/activemq-nms-api/blob/master/LICENSE.txt</PackageLicense>
<PackageIconUrl>https://activemq.apache.org/assets/img/activemq_logo_icon.png</PackageIconUrl>
<RepositoryUrl>https://github.com/apache/activemq-nms-api</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>apache;activemq;nms;api;net;test;messaging</PackageTags>

<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>keyfile\NMSKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<Compile Remove="obj\**" />
<Compile Remove="Resources\**" />
<Compile Remove="src\main\**" />
<EmbeddedResource Remove="obj\**" />
<EmbeddedResource Remove="Resources\**" />
<EmbeddedResource Remove="src\test\**" />
<None Remove="obj\**" />
<None Remove="Resources\**" />
<None Remove="src\main\**" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="vs2019-nms-api.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.12.0" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
@@ -0,0 +1,43 @@
<Project>
<PropertyGroup>
<MSBuildProjectExtensionsPath>obj\$(MSBuildProjectName)</MSBuildProjectExtensionsPath>
<BaseIntermediateOutputPath>obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Apache.NMS</PackageId>
<Version>1.8.0</Version>
<Authors>Apache ActiveMQ</Authors>
<Company>Apache Software Foundation</Company>
<Product>Apache NMS API</Product>
<Description>Apache NMS (.Net Standard Messaging Library): An abstract interface to Message Oriented Middleware (MOM) providers</Description>
<Copyright>Copyright (C) 2005-2019 Apache Software Foundation</Copyright>
<PackageProjectUrl>https://activemq.apache.org/components/nms/</PackageProjectUrl>
<PackageLicense>https://github.com/apache/activemq-nms-api/blob/master/LICENSE.txt</PackageLicense>
<PackageIconUrl>https://activemq.apache.org/assets/img/activemq_logo_icon.png</PackageIconUrl>
<RepositoryUrl>https://github.com/apache/activemq-nms-api</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>apache;activemq;nms;api;net;messaging</PackageTags>

<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>keyfile\NMSKey.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<Compile Remove="obj\**" />
<Compile Remove="Resources\**" />
<Compile Remove="src\test\**" />
<EmbeddedResource Remove="obj\**" />
<EmbeddedResource Remove="Resources\**" />
<EmbeddedResource Remove="src\test\**" />
<None Remove="obj\**" />
<None Remove="Resources\**" />
<None Remove="src\test\**" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project>
@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.28917.181
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vs2019-nms-api", "vs2019-nms-api.csproj", "{527FA0B7-FBA9-4D4F-B49A-014EC16ECC18}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "vs2019-nms-api-test", "vs2019-nms-api-test.csproj", "{54125058-69AF-46EA-BB09-BA739C6CBD3F}"
ProjectSection(ProjectDependencies) = postProject
{527FA0B7-FBA9-4D4F-B49A-014EC16ECC18} = {527FA0B7-FBA9-4D4F-B49A-014EC16ECC18}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{527FA0B7-FBA9-4D4F-B49A-014EC16ECC18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{527FA0B7-FBA9-4D4F-B49A-014EC16ECC18}.Debug|Any CPU.Build.0 = Debug|Any CPU
{527FA0B7-FBA9-4D4F-B49A-014EC16ECC18}.Release|Any CPU.ActiveCfg = Release|Any CPU
{527FA0B7-FBA9-4D4F-B49A-014EC16ECC18}.Release|Any CPU.Build.0 = Release|Any CPU
{54125058-69AF-46EA-BB09-BA739C6CBD3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{54125058-69AF-46EA-BB09-BA739C6CBD3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{54125058-69AF-46EA-BB09-BA739C6CBD3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{54125058-69AF-46EA-BB09-BA739C6CBD3F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {56A30ED4-C3B2-42E6-9BFE-383835662642}
EndGlobalSection
EndGlobal

0 comments on commit f9a6554

Please sign in to comment.