diff --git a/lang/csharp/.gitignore b/lang/csharp/.gitignore index b8e088c6160..944e701cc47 100644 --- a/lang/csharp/.gitignore +++ b/lang/csharp/.gitignore @@ -17,6 +17,9 @@ /*.user /*.suo /_ReSharper.Avro +/.vs +obj/ + ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. diff --git a/lang/csharp/Avro.nunit b/lang/csharp/Avro.nunit deleted file mode 100644 index 7cbd7993cd1..00000000000 --- a/lang/csharp/Avro.nunit +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/lang/csharp/Avro.sln b/lang/csharp/Avro.sln index 58687b2622a..6a88459f6a7 100644 --- a/lang/csharp/Avro.sln +++ b/lang/csharp/Avro.sln @@ -1,20 +1,24 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.main", "src\apache\main\Avro.main.csproj", "{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}" +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2027 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.main", "src\apache\main\Avro.main.csproj", "{A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.test", "src\apache\test\Avro.test.csproj", "{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.test", "src\apache\test\Avro.test.csproj", "{911D56AB-587B-4E5F-B5EA-D47D8A46F1FA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.codegen", "src\apache\codegen\Avro.codegen.csproj", "{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.codegen", "src\apache\codegen\Avro.codegen.csproj", "{BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.ipc", "src\apache\ipc\Avro.ipc.csproj", "{3B05043A-DC6C-49B6-85BF-9AB055D0B414}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.ipc", "src\apache\ipc\Avro.ipc.csproj", "{3B05043A-DC6C-49B6-85BF-9AB055D0B414}" ProjectSection(ProjectDependencies) = postProject {AEB22F94-4ECF-4008-B159-389B3F05D54B} = {AEB22F94-4ECF-4008-B159-389B3F05D54B} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.msbuild", "src\apache\msbuild\Avro.msbuild.csproj", "{AEB22F94-4ECF-4008-B159-389B3F05D54B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.msbuild", "src\apache\msbuild\Avro.msbuild.csproj", "{AEB22F94-4ECF-4008-B159-389B3F05D54B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avro.perf", "src\apache\perf\Avro.perf.csproj", "{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.perf", "src\apache\perf\Avro.perf.csproj", "{AC4E1909-2594-4D01-9B2B-B832C07BAFE5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avro.ipc.test", "src\apache\ipc.test\Avro.ipc.test.csproj", "{A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -50,14 +54,14 @@ Global {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Any CPU.Build.0 = Debug|Any CPU {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.ActiveCfg = Debug|x86 - {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.Build.0 = Debug|x86 + {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.ActiveCfg = Debug|Any CPU + {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Debug|x86.Build.0 = Debug|Any CPU {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.ActiveCfg = Release|Any CPU {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Any CPU.Build.0 = Release|Any CPU - {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.ActiveCfg = Release|x86 - {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.Build.0 = Release|x86 - {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.ActiveCfg = Release|x86 - {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.Build.0 = Release|x86 + {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.ActiveCfg = Release|Any CPU + {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8}.Release|x86.Build.0 = Release|Any CPU {3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Any CPU.Build.0 = Debug|Any CPU {3B05043A-DC6C-49B6-85BF-9AB055D0B414}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -88,8 +92,23 @@ Global {AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|Mixed Platforms.Build.0 = Release|Any CPU {AC4E1909-2594-4D01-9B2B-B832C07BAFE5}.Release|x86.ActiveCfg = Release|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|x86.ActiveCfg = Debug|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Debug|x86.Build.0 = Debug|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Any CPU.Build.0 = Release|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|Mixed Platforms.Build.0 = Release|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|x86.ActiveCfg = Release|Any CPU + {A5C8B22C-BC43-4763-8B92-EB0CEA739ED1}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ACE75CE8-16B2-4C6E-A5BE-B6F6DB5FE095} + EndGlobalSection EndGlobal diff --git a/lang/csharp/README b/lang/csharp/README deleted file mode 100644 index 34909dd7ec4..00000000000 --- a/lang/csharp/README +++ /dev/null @@ -1,40 +0,0 @@ -1. Building Avro for .NET - -a. Windows - -Prerequisites - Microsoft Visual C# Express 2010 - -To build open Avro.sln solution in VC# Express 2010 and build from there. - -b. Linux - -Prerequisites - Mono 2.6 or above. - -For Ubuntu Lucid Lynx, mono that comes with it is 2.4. To install mono 2.6 -follow the procedure described at http://badgerports.org/ - -To build issue the command: -$ cd lang/csharp - -then - -$ CONFIGURATION=Release TARGETFRAMEWORKVERSION=3.5 xbuild Avro.sln - -or - -$ CONFIGURATION=Debug TARGETFRAMEWORKVERSION=3.5 xbuild Avro.sln - -Note: In Ubuntu 12.04 (Precise Pangolin), please omit TARGETFRAMEWORKVERSION argument and leave it to the default. - -2. Unit tests - -This is a common procedure for both Windows and Linux. - -To run unit-tests, please install NUnit 2.5 or above. From within the NUnit -GUI, open the project Avro.nunit and run the tests. - -3. Notes - -a. The LICENSE and NOTICE files in the lang/csharp source directory are used to build the binary distribution. The LICENSE and NOTICE information for the Avro C# source distribution is in the root directory. diff --git a/lang/csharp/README.md b/lang/csharp/README.md new file mode 100644 index 00000000000..35d19766bf4 --- /dev/null +++ b/lang/csharp/README.md @@ -0,0 +1,42 @@ +# Avro C# + +## Build & Test + +### Windows + +1. Install [Microsoft Visual Studio Community 2017](https://www.visualstudio.com/downloads/) +2. `./build.ps1 Test` + +### Linux with Mono + +1. Install [Mono v5.18+](https://www.mono-project.com/download/stable/). Install the **mono-devel** + and **mono-complete** packages. +2. `./build.sh test` + +### Linux with .NET Core SDK + +1. Install [.NET Core SDK 2.1+](https://www.microsoft.com/net/download/linux) +2. Build and run unit tests: + ``` + cd src/apache/test + dotnet test --framework netcoreapp2.0 + ``` + +## Target Frameworks + +The table below shows the frameworks that the various projects target. + +Project | Type | .NET Standard 2.0 | .NET Core 2.0 | .NET Framework 4.0 +------------ | ------------ |:------------------:|:------------------:|:------------------: +Avro.codegen | Exe | | :heavy_check_mark: | :heavy_check_mark: +Avro.ipc | Library | | | :heavy_check_mark: +Avro.ipc.test | Unit Tests | | | :heavy_check_mark: +Avro.main | Exe | :heavy_check_mark: | | :heavy_check_mark: +Avro.msbuild | Library | :heavy_check_mark: | | :heavy_check_mark: +Avro.perf | Exe | | :heavy_check_mark: | :heavy_check_mark: +Avro.test | Unit Tests | | :heavy_check_mark: | :heavy_check_mark: + + +## Notes + +The [LICENSE](./LICENSE) and [NOTICE](./NOTICE) files in the lang/csharp source directory are used to build the binary distribution. The [LICENSE.txt](../../LICENSE.txt) and [NOTICE.txt](../../NOTICE.txt) information for the Avro C# source distribution is in the root directory. diff --git a/lang/csharp/build.ps1 b/lang/csharp/build.ps1 new file mode 100644 index 00000000000..edb84115892 --- /dev/null +++ b/lang/csharp/build.ps1 @@ -0,0 +1,59 @@ +#!/usr/bin/env pwsh + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +param( + [Parameter(Position=0)] + [ValidateSet('Test')] + [string] + $Target = 'Test', + + [Parameter()] + [ValidateSet('Release', 'Debug')] + [string] + $Configuration = 'Release' +) + +# Catch any PowerShell errors and exit with a non-zero exit code. +$ErrorActionPreference = 'Stop' +trap { + $ErrorActionPreference = 'Continue' + Write-Error $_ + exit 1 +} + +# Checks the LASTEXITCODE. If it is non-zero, exits with that code. +function checkExitCode { + if ($LASTEXITCODE) { + exit $LASTEXITCODE + } +} + +try { + Push-Location $PSScriptRoot + + switch ($Target) { + "Test" { + dotnet build --configuration $Configuration + checkExitCode + + dotnet test --configuration $Configuration --no-build ./src/apache/test/Avro.test.csproj + checkExitCode + } + } +} finally { + Pop-Location +} diff --git a/lang/csharp/build.sh b/lang/csharp/build.sh index cb9f7fc896d..b84d3ad7601 100755 --- a/lang/csharp/build.sh +++ b/lang/csharp/build.sh @@ -23,24 +23,23 @@ cd `dirname "$0"` # connect to root ROOT=../.. VERSION=`cat $ROOT/share/VERSION.txt` -export CONFIGURATION=Release -export TARGETFRAMEWORKVERSION=v3.5 - case "$1" in test) - xbuild - nunit-console Avro.nunit + msbuild /t:"restore;build" /p:"Configuration=Release" + mono ${HOME}/.nuget/packages/nunit.consolerunner/3.9.0/tools/nunit3-console.exe \ + --noheader --labels=All \ + src/apache/test/bin/Release/net40/Avro.test.dll ;; perf) - xbuild + msbuild /t:"restore;build" /p:"Configuration=Release" mono build/perf/Release/Avro.perf.exe ;; dist) # build binary tarball - xbuild + msbuild /t:"restore;build" /p:"Configuration=Release" # add the binary LICENSE and NOTICE to the tarball cp LICENSE NOTICE build/ mkdir -p $ROOT/dist/csharp diff --git a/lang/csharp/lib/main/Castle.Core.dll b/lang/csharp/lib/main/Castle.Core.dll deleted file mode 100644 index ccc7d5ff62e..00000000000 Binary files a/lang/csharp/lib/main/Castle.Core.dll and /dev/null differ diff --git a/lang/csharp/lib/main/Newtonsoft.Json.dll b/lang/csharp/lib/main/Newtonsoft.Json.dll deleted file mode 100644 index 4703b89058a..00000000000 Binary files a/lang/csharp/lib/main/Newtonsoft.Json.dll and /dev/null differ diff --git a/lang/csharp/lib/main/log4net.dll b/lang/csharp/lib/main/log4net.dll deleted file mode 100644 index ffc57e11254..00000000000 Binary files a/lang/csharp/lib/main/log4net.dll and /dev/null differ diff --git a/lang/csharp/lib/test/nunit.framework.dll b/lang/csharp/lib/test/nunit.framework.dll deleted file mode 100644 index 639dbb0dce5..00000000000 Binary files a/lang/csharp/lib/test/nunit.framework.dll and /dev/null differ diff --git a/lang/csharp/src/apache/codegen/Avro.codegen.csproj b/lang/csharp/src/apache/codegen/Avro.codegen.csproj index 695929efc2a..9a716c585ff 100644 --- a/lang/csharp/src/apache/codegen/Avro.codegen.csproj +++ b/lang/csharp/src/apache/codegen/Avro.codegen.csproj @@ -1,162 +1,34 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {BF0D313C-1AA3-4900-B277-B0F5F9DDCDA8} - Exe - Properties - Avro.codegen - avrogen - v3.5 - 512 - false - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - true - - - - AnyCPU - true - full - false - ..\..\..\build\codegen\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - none - true - ..\..\..\build\codegen\Release\ - - - prompt - 4 - - - true - ..\..\..\build\codegen\Debug\ - DEBUG;TRACE - full - AnyCPU - ..\..\..\build\codegen\Debug\avrogen.exe.CodeAnalysisLog.xml - true - GlobalSuppressions.cs - prompt - MinimumRecommendedRules.ruleset - ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets - true - ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules - true - Off - - - ..\..\..\build\codegen\Release\ - - - true - none - AnyCPU - ..\..\..\build\codegen\Release\avrogen.exe.CodeAnalysisLog.xml - true - GlobalSuppressions.cs - prompt - MinimumRecommendedRules.ruleset - ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets - false - ;C:\Program Files\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules - false - Off - - - ..\..\..\build\codegen\Release\ - - - true - - - ..\..\..\Avro.snk - - - - - - - - - - - - - - - - {A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0} - Avro.main - - - - - False - Microsoft .NET Framework 3.5 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - - - - \ No newline at end of file + + + + + Exe + net40;netcoreapp2.0 + avrogen + Avro.codegen + false + true + ..\..\..\Avro.snk + + + + + + + + diff --git a/lang/csharp/src/apache/ipc.test/Avro.ipc.test.csproj b/lang/csharp/src/apache/ipc.test/Avro.ipc.test.csproj new file mode 100644 index 00000000000..16272413dce --- /dev/null +++ b/lang/csharp/src/apache/ipc.test/Avro.ipc.test.csproj @@ -0,0 +1,61 @@ + + + + + net40 + Avro.ipc.test + Avro.ipc.test + false + + + + + mail.avpr + + + + + + 3.10.1 + + + 3.10.0 + + + 3.9.0 + + + + + + + + + + + + + + + + + + + + + diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/All.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/All.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/All.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/All.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllCallback.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllCallback.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllCallback.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllCallback.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllEnum.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllEnum.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllEnum.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllEnum.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllTestRecord.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/AllTestRecordPartial.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/FixedTest.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/FixedTest.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/FixedTest.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/FixedTest.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Kind.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Kind.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Kind.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Kind.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MD5.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/MD5.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MD5.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/MD5.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Mail.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Mail.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Mail.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Mail.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MailCallback.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/MailCallback.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/MailCallback.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/MailCallback.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Message.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Message.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Message.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Message.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Simple.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Simple.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/Simple.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/Simple.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/SimpleCallback.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestError.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestError.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestError.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestError.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecord.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestRecord.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecord.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestRecord.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestRecordExtensions.cs diff --git a/lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs b/lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs rename to lang/csharp/src/apache/ipc.test/GeneratedFiles/org/apache/avro/test/TestRecordWithUnion.cs diff --git a/lang/csharp/src/apache/test/Ipc/HttpClientServerTest.cs b/lang/csharp/src/apache/ipc.test/HttpClientServerTest.cs similarity index 97% rename from lang/csharp/src/apache/test/Ipc/HttpClientServerTest.cs rename to lang/csharp/src/apache/ipc.test/HttpClientServerTest.cs index 5c2ddf6cd93..36979006e0c 100644 --- a/lang/csharp/src/apache/test/Ipc/HttpClientServerTest.cs +++ b/lang/csharp/src/apache/ipc.test/HttpClientServerTest.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -42,7 +42,7 @@ public class HttpClientServerTest const string URL = @"http://localhost:18080/avro/test/ipc/mailResponder/"; - [TestFixtureSetUp] + [OneTimeSetUp] //[TestInitialize] public void Init() { @@ -58,7 +58,7 @@ public void Init() proxy = new GenericRequestor(transceiver, MailResponder.Protocol); } - [TestFixtureTearDown] + [OneTimeTearDown] //[TestCleanup] public void Cleanup() { diff --git a/lang/csharp/src/apache/test/Ipc/LocalTransceiverTest.cs b/lang/csharp/src/apache/ipc.test/LocalTransceiverTest.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/LocalTransceiverTest.cs rename to lang/csharp/src/apache/ipc.test/LocalTransceiverTest.cs diff --git a/lang/csharp/src/apache/test/Ipc/MailResponder.cs b/lang/csharp/src/apache/ipc.test/MailResponder.cs similarity index 98% rename from lang/csharp/src/apache/test/Ipc/MailResponder.cs rename to lang/csharp/src/apache/ipc.test/MailResponder.cs index b6502c5544a..73212f7c598 100644 --- a/lang/csharp/src/apache/test/Ipc/MailResponder.cs +++ b/lang/csharp/src/apache/ipc.test/MailResponder.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -46,7 +46,7 @@ public static Protocol Protocol string readAllLines; using ( Stream stream = - Assembly.GetExecutingAssembly().GetManifestResourceStream("Avro.test.Ipc.mail.avpr")) + Assembly.GetExecutingAssembly().GetManifestResourceStream("Avro.ipc.test.mail.avpr")) using (var reader = new StreamReader(stream)) { readAllLines = reader.ReadToEnd(); @@ -99,4 +99,4 @@ public override void WriteError(Schema schema, object error, Encoder output) Assert.Fail(error.ToString()); } } -} \ No newline at end of file +} diff --git a/lang/csharp/src/apache/ipc.test/Properties/AssemblyInfo.cs b/lang/csharp/src/apache/ipc.test/Properties/AssemblyInfo.cs new file mode 100644 index 00000000000..a19b7f1ff15 --- /dev/null +++ b/lang/csharp/src/apache/ipc.test/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Reflection; +using System.Runtime.InteropServices; + +[assembly: AssemblyTitle("Avro.ipc.test")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Apache")] +[assembly: AssemblyProduct("Avro.ipc.test")] +[assembly: AssemblyCopyright("Copyright © Apache 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: ComVisible(false)] +[assembly: Guid("442785CE-3633-4A04-A103-434104F63D55")] +[assembly: AssemblyVersion("0.9.0.0")] +[assembly: AssemblyFileVersion("0.9.0.0")] \ No newline at end of file diff --git a/lang/csharp/src/apache/test/Ipc/SerializationTest.cs b/lang/csharp/src/apache/ipc.test/SerializationTest.cs similarity index 98% rename from lang/csharp/src/apache/test/Ipc/SerializationTest.cs rename to lang/csharp/src/apache/ipc.test/SerializationTest.cs index 84104a0e548..58198023cb6 100644 --- a/lang/csharp/src/apache/test/Ipc/SerializationTest.cs +++ b/lang/csharp/src/apache/ipc.test/SerializationTest.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -60,7 +60,7 @@ public override AllTestRecord echoParameters(bool booleanTest, int intTest, long private SocketTransceiver transceiver; private All simpleClient; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { var mailResponder = new SpecificResponder(new AllImpl()); @@ -73,7 +73,7 @@ public void Init() simpleClient = SpecificRequestor.CreateClient(transceiver); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { server.Stop(); @@ -150,4 +150,4 @@ private static AllTestRecord CreateExpectedTestData() }; } } -} \ No newline at end of file +} diff --git a/lang/csharp/src/apache/test/Ipc/SocketServerConcurrentExecutionTest.cs b/lang/csharp/src/apache/ipc.test/SocketServerConcurrentExecutionTest.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/SocketServerConcurrentExecutionTest.cs rename to lang/csharp/src/apache/ipc.test/SocketServerConcurrentExecutionTest.cs diff --git a/lang/csharp/src/apache/test/Ipc/SocketServerTest.cs b/lang/csharp/src/apache/ipc.test/SocketServerTest.cs similarity index 98% rename from lang/csharp/src/apache/test/Ipc/SocketServerTest.cs rename to lang/csharp/src/apache/ipc.test/SocketServerTest.cs index 1a1747bfad1..9d091ae3dc7 100644 --- a/lang/csharp/src/apache/test/Ipc/SocketServerTest.cs +++ b/lang/csharp/src/apache/ipc.test/SocketServerTest.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -33,7 +33,7 @@ public class SocketServerTest private SocketTransceiver transceiver; private GenericRequestor proxy; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { mailResponder = new MailResponder(); @@ -45,7 +45,7 @@ public void Init() proxy = new GenericRequestor(transceiver, MailResponder.Protocol); } - [TestFixtureTearDown] + [OneTimeTearDown] public void Cleanup() { server.Stop(); @@ -184,4 +184,4 @@ public void TestRequestResponse() } } } -} \ No newline at end of file +} diff --git a/lang/csharp/src/apache/test/Ipc/SocketServerWithCallbacksTest.cs b/lang/csharp/src/apache/ipc.test/SocketServerWithCallbacksTest.cs similarity index 99% rename from lang/csharp/src/apache/test/Ipc/SocketServerWithCallbacksTest.cs rename to lang/csharp/src/apache/ipc.test/SocketServerWithCallbacksTest.cs index c625e63ec26..3cd9176bde9 100644 --- a/lang/csharp/src/apache/test/Ipc/SocketServerWithCallbacksTest.cs +++ b/lang/csharp/src/apache/ipc.test/SocketServerWithCallbacksTest.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -37,7 +37,7 @@ public class SocketServerWithCallbacksTest private SocketTransceiver transceiver; private SimpleCallback simpleClient; - [TestFixtureSetUp] + [OneTimeSetUp] public void Init() { var responder = new SpecificResponder(new SimpleImpl()); @@ -48,7 +48,7 @@ public void Init() simpleClient = SpecificRequestor.CreateClient(transceiver); } - [TestFixtureTearDown] + [OneTimeTearDown] public void TearDown() { try @@ -557,28 +557,28 @@ public void EchoBytes() Assert.AreEqual(byteBuffer, future2.WaitForResult(2000)); Assert.IsNull(future2.Error); - } - - [Test, TestCase(false, TestName = "Specific error"), TestCase(true, TestName = "System error")] + } + + [Test, TestCase(false, TestName = "Specific error"), TestCase(true, TestName = "System error")] public void Error(bool systemError) - { + { Type expected; if(systemError) { expected = typeof(Exception); SimpleImpl.throwSystemError = true; - } - else - { - expected = typeof(TestError); - SimpleImpl.throwSystemError = false; + } + else + { + expected = typeof(TestError); + SimpleImpl.throwSystemError = false; } // Test synchronous RPC: try { - simpleClient.error(); + simpleClient.error(); Assert.Fail("Expected " + expected.Name + " to be thrown"); } catch (Exception e) @@ -593,10 +593,10 @@ public void Error(bool systemError) { future.WaitForResult(2000); Assert.Fail("Expected " + expected.Name + " to be thrown"); - } - catch (Exception e) - { - Assert.AreEqual(expected, e.GetType()); + } + catch (Exception e) + { + Assert.AreEqual(expected, e.GetType()); } Assert.IsNotNull(future.Error); @@ -617,8 +617,8 @@ public void Error(bool systemError) Assert.IsTrue(latch.Wait(2000), "Timed out waiting for error"); Assert.IsNotNull(errorRef); Assert.AreEqual(expected, errorRef.GetType()); - } - + } + [Test] public void Greeting() { @@ -764,7 +764,7 @@ public void TestSendAfterChannelClose() } private class SimpleImpl : Simple - { + { public static bool throwSystemError = false; public override string hello(string greeting) @@ -803,4 +803,4 @@ public override void ack() } } -} \ No newline at end of file +} diff --git a/lang/csharp/src/apache/test/Ipc/SocketTransceiverWhenServerStopsTest.cs b/lang/csharp/src/apache/ipc.test/SocketTransceiverWhenServerStopsTest.cs similarity index 100% rename from lang/csharp/src/apache/test/Ipc/SocketTransceiverWhenServerStopsTest.cs rename to lang/csharp/src/apache/ipc.test/SocketTransceiverWhenServerStopsTest.cs diff --git a/lang/csharp/src/apache/ipc/Avro.ipc.csproj b/lang/csharp/src/apache/ipc/Avro.ipc.csproj index 9d738c928f7..6b6793618d7 100644 --- a/lang/csharp/src/apache/ipc/Avro.ipc.csproj +++ b/lang/csharp/src/apache/ipc/Avro.ipc.csproj @@ -1,108 +1,37 @@ - - - - - Debug - AnyCPU - {3B05043A-DC6C-49B6-85BF-9AB055D0B414} - Library - Properties - Avro.ipc - Avro.ipc - v3.5 - 512 - - - - true - full - false - ..\..\..\build\ipc\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - pdbonly - true - ..\..\..\build\ipc\Release\ - TRACE - prompt - 4 - - - true - - - ..\..\..\Avro.snk - - - - ..\..\..\lib\main\Castle.Core.dll - - - ..\..\..\lib\main\log4net.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {a0a5ca3c-f58c-4d07-98b0-2c7b62ab20f0} - Avro.main - - - - - - - - - \ No newline at end of file + + + + + net40 + Avro.ipc + Avro.ipc + false + true + ..\..\..\Avro.snk + + + + + + + + + + + + diff --git a/lang/csharp/src/apache/main/Avro.main.csproj b/lang/csharp/src/apache/main/Avro.main.csproj index 7f41e3ff928..91c551d8124 100644 --- a/lang/csharp/src/apache/main/Avro.main.csproj +++ b/lang/csharp/src/apache/main/Avro.main.csproj @@ -1,4 +1,3 @@ - - + + - Debug - AnyCPU - 8.0.30703 - 2.0 - {A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0} - Library - Properties - Avro + net40;netstandard2.0 Avro - v3.5 - 512 - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - true - full - false - ..\..\..\build\main\Debug\ - DEBUG;TRACE - prompt - 4 - Off - - - none - true - ..\..\..\build\main\Release\ - - - prompt - 4 - Off - - + Avro + false true - - ..\..\..\Avro.snk - - - ..\..\..\lib\main\log4net.dll - - - ..\..\..\lib\main\Newtonsoft.Json.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - - False - Microsoft .NET Framework 4 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - + + NU1701 + - - - \ No newline at end of file + + diff --git a/lang/csharp/src/apache/main/Properties/Settings.Designer.cs b/lang/csharp/src/apache/main/Properties/Settings.Designer.cs deleted file mode 100644 index dc7cb6df807..00000000000 --- a/lang/csharp/src/apache/main/Properties/Settings.Designer.cs +++ /dev/null @@ -1,44 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.1 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -namespace Avro.Properties { - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default { - get { - return defaultInstance; - } - } - } -} diff --git a/lang/csharp/src/apache/main/Schema/JsonHelper.cs b/lang/csharp/src/apache/main/Schema/JsonHelper.cs index 13db058edbf..4b75765aae1 100644 --- a/lang/csharp/src/apache/main/Schema/JsonHelper.cs +++ b/lang/csharp/src/apache/main/Schema/JsonHelper.cs @@ -42,8 +42,7 @@ public static string GetOptionalString(JToken jtok, string field) if (child.Type == JTokenType.String) { - string value = child.ToString(); - return value.Trim('\"'); + return child.Value(); } throw new SchemaParseException("Field " + field + " is not a string"); } diff --git a/lang/csharp/src/apache/main/Schema/Property.cs b/lang/csharp/src/apache/main/Schema/Property.cs index 521cfd1c2b2..de08c17546e 100644 --- a/lang/csharp/src/apache/main/Schema/Property.cs +++ b/lang/csharp/src/apache/main/Schema/Property.cs @@ -44,7 +44,7 @@ public void Parse(JToken jtok) if (ReservedProps.Contains(prop.Name)) continue; if (!ContainsKey(prop.Name)) - Add(prop.Name, prop.Value.ToString()); + Add(prop.Name, JsonConvert.SerializeObject(prop.Value)); } } diff --git a/lang/csharp/src/apache/msbuild/Avro.msbuild.csproj b/lang/csharp/src/apache/msbuild/Avro.msbuild.csproj index f1dd6f8f734..096caf8fd0d 100644 --- a/lang/csharp/src/apache/msbuild/Avro.msbuild.csproj +++ b/lang/csharp/src/apache/msbuild/Avro.msbuild.csproj @@ -1,4 +1,3 @@ - - - + + - Debug - AnyCPU - {AEB22F94-4ECF-4008-B159-389B3F05D54B} - Library - Properties - Avro.msbuild + net40;netstandard2.0 Avro.msbuild - v3.5 - 512 - - - - true - full - false - ..\..\..\build\msbuild\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - ..\..\..\build\msbuild\Release\ - TRACE - prompt - 4 + Avro.msbuild + false - - - - - - + + + + - - - + + + + + + - - {A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0} - Avro.main - + - - - \ No newline at end of file + + diff --git a/lang/csharp/src/apache/perf/Avro.perf.csproj b/lang/csharp/src/apache/perf/Avro.perf.csproj index 7235c99bcbd..6fb706c95c5 100644 --- a/lang/csharp/src/apache/perf/Avro.perf.csproj +++ b/lang/csharp/src/apache/perf/Avro.perf.csproj @@ -1,4 +1,3 @@ - - + + - Debug - AnyCPU - 8.0.30703 - 2.0 - {AC4E1909-2594-4D01-9B2B-B832C07BAFE5} Exe - Properties - Avro.perf + net40;netcoreapp2.0 Avro.perf - v3.5 - 512 - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - true - full - false - ..\..\..\build\perf\Debug\ - DEBUG;TRACE - prompt - 4 - Off - - - none - true - ..\..\..\build\perf\Release\ - - - prompt - 4 - Off - - - + Avro.perf + false + - - False - ..\..\..\..\..\lang\csharp\lib\main\Castle.Core.dll - - - False - ..\..\..\lib\test\nunit.framework.dll - - - - - - - - - - - {3b05043a-dc6c-49b6-85bf-9ab055d0b414} - Avro.ipc - - - {A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0} - Avro.main - - - - - False - Microsoft .NET Framework 4 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - - - - - - - - - Code - - - - - + - - - \ No newline at end of file + + diff --git a/lang/csharp/src/apache/test/Avro.test.csproj b/lang/csharp/src/apache/test/Avro.test.csproj index 841f4f2df0b..6f0d73c5c21 100644 --- a/lang/csharp/src/apache/test/Avro.test.csproj +++ b/lang/csharp/src/apache/test/Avro.test.csproj @@ -1,168 +1,54 @@ - - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {911D56AB-587B-4E5F-B5EA-D47D8A46F1FA} - Library - Properties - Avro.test - Avro.test - v3.5 - 512 - - - 3.5 - - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - true - full - false - ..\..\..\build\test\Debug\ - DEBUG;TRACE - prompt - 4 - Off - - - none - true - ..\..\..\build\test\Release\ - - - prompt - 4 - Off - - - - False - ..\..\..\..\..\lang\csharp\lib\main\Castle.Core.dll - - - False - ..\..\..\lib\test\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {3b05043a-dc6c-49b6-85bf-9ab055d0b414} - Avro.ipc - - - {A0A5CA3C-F58C-4D07-98B0-2C7B62AB20F0} - Avro.main - - - - - False - Microsoft .NET Framework 4 %28x86 and x64%29 - true - - - False - .NET Framework 3.5 SP1 - false - - - False - Windows Installer 3.1 - true - - - - - Ipc\mail.avpr - - - - - - \ No newline at end of file + + + + + net40;netcoreapp2.0 + Avro.test + Avro.test + false + + + + + 3.10.1 + + + 3.10.0 + + + 3.9.0 + + + + + + + + + + + + + + + + + + + + diff --git a/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs b/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs index f1141dbb369..b96bbed4961 100644 --- a/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs +++ b/lang/csharp/src/apache/test/CodGen/CodeGenTest.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -30,6 +30,7 @@ namespace Avro.Test class CodeGenTest { +#if !NETCOREAPP2_0 // System.CodeDom compilation not supported in .NET Core: https://github.com/dotnet/corefx/issues/12180 [TestCase(@"{ ""type"" : ""record"", ""name"" : ""ClassKeywords"", @@ -48,7 +49,7 @@ class CodeGenTest { ""name"" : ""string"", ""type"" : { ""type"": ""fixed"", ""size"": 16, ""name"": ""static"" } } ] } -", new object[] {"com.base.ClassKeywords", typeof(int), typeof(long), typeof(bool), typeof(double), typeof(float), typeof(byte[]), typeof(string),typeof(object),"com.base.class", "com.base.static"})] +", new object[] {"com.base.ClassKeywords", typeof(int), typeof(long), typeof(bool), typeof(double), typeof(float), typeof(byte[]), typeof(string),typeof(object),"com.base.class", "com.base.static"}, TestName = "TestCodeGen0")] [TestCase(@"{ ""type"" : ""record"", ""name"" : ""SchemaObject"", @@ -67,7 +68,7 @@ class CodeGenTest } ] } -", new object[] { "schematest.SchemaObject", typeof(IList) })] +", new object[] { "schematest.SchemaObject", typeof(IList) }, TestName = "TestCodeGen1")] public static void TestCodeGen(string str, object[] result) { Schema schema = Schema.Parse(str); @@ -149,7 +150,7 @@ private static CompilerResults GenerateAssembly(CodeGen schema) var comparam = new CompilerParameters(new string[] { "mscorlib.dll" }); comparam.ReferencedAssemblies.Add("System.dll"); - comparam.ReferencedAssemblies.Add("Avro.dll"); + comparam.ReferencedAssemblies.Add(Path.Combine(TestContext.CurrentContext.TestDirectory, "Avro.dll")); comparam.GenerateInMemory = true; var ccp = new CSharpCodeProvider(); var units = new[] { compileUnit }; @@ -162,5 +163,6 @@ private static CompilerResults GenerateAssembly(CodeGen schema) Assert.AreEqual(0, compres.Errors.Count); return compres; } +#endif } } diff --git a/lang/csharp/src/apache/test/File/FileTests.cs b/lang/csharp/src/apache/test/File/FileTests.cs index b3dbfb28f9c..9d7f1d7e61f 100644 --- a/lang/csharp/src/apache/test/File/FileTests.cs +++ b/lang/csharp/src/apache/test/File/FileTests.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -40,15 +40,15 @@ public class FileTests /// /// /// - [TestCase(specificSchema, new object[] { new object[] { "John", 23 } }, Codec.Type.Deflate)] - [TestCase(specificSchema, new object[] { new object[] { "Jane", 23 } }, Codec.Type.Deflate)] - [TestCase(specificSchema, new object[] { new object[] { "John", 23 }, new object[] { "Jane", 99 }, new object[] { "Jeff", 88 } }, Codec.Type.Deflate)] + [TestCase(specificSchema, new object[] { new object[] { "John", 23 } }, Codec.Type.Deflate, TestName = "TestSpecificData0")] + [TestCase(specificSchema, new object[] { new object[] { "Jane", 23 } }, Codec.Type.Deflate, TestName = "TestSpecificData1")] + [TestCase(specificSchema, new object[] { new object[] { "John", 23 }, new object[] { "Jane", 99 }, new object[] { "Jeff", 88 } }, Codec.Type.Deflate, TestName = "TestSpecificData2")] [TestCase(specificSchema, new object[] { new object[] {"John", 23}, new object[] { "Jane", 99 }, new object[] { "Jeff", 88 }, new object[] {"James", 13}, new object[] { "June", 109 }, new object[] { "Lloyd", 18 }, - new object[] {"Jenny", 3}, new object[] { "Bob", 9 }, new object[] { null, 48 }}, Codec.Type.Deflate)] - [TestCase(specificSchema, new object[] { new object[] { "John", 23 } }, Codec.Type.Null)] - [TestCase(specificSchema, new object[] { new object[] { "Jane", 23 } }, Codec.Type.Null)] - [TestCase(specificSchema, new object[] { new object[] { "John", 23 }, new object[] { "Jane", 99 }, new object[] { "Jeff", 88 } }, Codec.Type.Null)] + new object[] {"Jenny", 3}, new object[] { "Bob", 9 }, new object[] { null, 48 }}, Codec.Type.Deflate, TestName = "TestSpecificData3")] + [TestCase(specificSchema, new object[] { new object[] { "John", 23 } }, Codec.Type.Null, TestName = "TestSpecificData4")] + [TestCase(specificSchema, new object[] { new object[] { "Jane", 23 } }, Codec.Type.Null, TestName = "TestSpecificData5")] + [TestCase(specificSchema, new object[] { new object[] { "John", 23 }, new object[] { "Jane", 99 }, new object[] { "Jeff", 88 } }, Codec.Type.Null, TestName = "TestSpecificData6")] [TestCase(specificSchema, new object[] { new object[] {"John", 23}, new object[] { "Jane", 99 }, new object[] { "Jeff", 88 }, new object[] {"James", 13}, new object[] { "June", 109 }, new object[] { "Lloyd", 18 }, new object[] {"Jamie", 53}, new object[] { "Fanessa", 101 }, new object[] { "Kan", 18 }, @@ -59,7 +59,7 @@ public class FileTests new object[] {"Ernie", 43}, new object[] { "Joel", 99 }, new object[] { "Dan", 78 }, new object[] {"Dave", 103}, new object[] { "Hillary", 79 }, new object[] { "Grant", 88 }, new object[] {"JJ", 14}, new object[] { "Bill", 90 }, new object[] { "Larry", 4 }, - new object[] {"Jenny", 3}, new object[] { "Bob", 9 }, new object[] { null, 48 }}, Codec.Type.Null)] + new object[] {"Jenny", 3}, new object[] { "Bob", 9 }, new object[] { null, 48 }}, Codec.Type.Null, TestName = "TestSpecificData7")] public void TestSpecificData(string schemaStr, object[] recs, Codec.Type codecType) { // create and write out @@ -471,11 +471,11 @@ private static void AssertNumRecordsFromPosition( IFileReader reader, long [TestCase(specificSchema, Codec.Type.Null, 2, 0, 1)] [TestCase(specificSchema, Codec.Type.Null, 10, 1, 4)] [TestCase(specificSchema, Codec.Type.Null, 200, 111, 15)] - [TestCase(specificSchema, Codec.Type.Null, 1000, 588, 998)] + // Disabled due to long runtime [TestCase(specificSchema, Codec.Type.Null, 1000, 588, 998)] [TestCase(specificSchema, Codec.Type.Deflate, 2, 0, 1)] [TestCase(specificSchema, Codec.Type.Deflate, 10, 1, 4)] [TestCase(specificSchema, Codec.Type.Deflate, 200, 111, 15)] - [TestCase(specificSchema, Codec.Type.Deflate, 1000, 588, 998)] + // Disabled due to long runtime [TestCase(specificSchema, Codec.Type.Deflate, 1000, 588, 998)] public void TestSyncAndSeekPositions(string schemaStr, Codec.Type codecType, int iterations, int firstSyncPosition, int secondSyncPosition) { // create and write out diff --git a/lang/csharp/src/apache/test/Generic/GenericTests.cs b/lang/csharp/src/apache/test/Generic/GenericTests.cs index b5bdc8d3fb5..c65ad8b14cd 100644 --- a/lang/csharp/src/apache/test/Generic/GenericTests.cs +++ b/lang/csharp/src/apache/test/Generic/GenericTests.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -121,11 +121,17 @@ public void TestUnion_record(string unionSchema, string recordSchema, object[] v [TestCase("[{\"type\": \"enum\", \"symbols\": [\"s1\", \"s2\"], \"name\": \"e\"}, \"string\"]", "{\"type\": \"enum\", \"symbols\": [\"s1\", \"s2\"], \"name\": \"e\"}", "s2")] [TestCase("[{\"type\": \"enum\", \"symbols\": [\"s1\", \"s2\"], \"name\": \"e\"}, \"string\"]", - "{\"type\": \"enum\", \"symbols\": [\"s1\", \"s2\"], \"name\": \"e\"}", "s3", - ExpectedException = typeof(AvroException))] - public void TestUnion_enum(string unionSchema, string enumSchema, string value) + "{\"type\": \"enum\", \"symbols\": [\"s1\", \"s2\"], \"name\": \"e\"}", "s3", typeof(AvroException))] + public void TestUnion_enum(string unionSchema, string enumSchema, string value, Type expectedExceptionType = null) { - test(unionSchema, mkEnum(enumSchema, value)); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { test(unionSchema, mkEnum(enumSchema, value)); }); + } + else + { + test(unionSchema, mkEnum(enumSchema, value)); + } } @@ -139,14 +145,19 @@ public void TestUnion_map(string unionSchema, string mapSchema, object[] value) [TestCase("[{\"type\": \"fixed\", \"size\": 2, \"name\": \"f\"}, \"string\"]", "{\"type\": \"fixed\", \"size\": 2, \"name\": \"f\"}", new byte[] { 1, 2 })] [TestCase("[{\"type\": \"fixed\", \"size\": 2, \"name\": \"f\"}, \"string\"]", - "{\"type\": \"fixed\", \"size\": 2, \"name\": \"f\"}", new byte[] { 1, 2, 3 }, - ExpectedException = typeof(AvroException))] + "{\"type\": \"fixed\", \"size\": 2, \"name\": \"f\"}", new byte[] { 1, 2, 3 }, typeof(AvroException))] [TestCase("[{\"type\": \"fixed\", \"size\": 2, \"name\": \"f\"}, \"string\"]", - "{\"type\": \"fixed\", \"size\": 3, \"name\": \"f\"}", new byte[] { 1, 2, 3 }, - ExpectedException = typeof(AvroException))] - public void TestUnion_fixed(string unionSchema, string fixedSchema, byte[] value) + "{\"type\": \"fixed\", \"size\": 3, \"name\": \"f\"}", new byte[] { 1, 2, 3 }, typeof(AvroException))] + public void TestUnion_fixed(string unionSchema, string fixedSchema, byte[] value, Type expectedExceptionType = null) { - test(unionSchema, mkFixed(fixedSchema, value)); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { test(unionSchema, mkFixed(fixedSchema, value)); }); + } + else + { + test(unionSchema, mkFixed(fixedSchema, value)); + } } public void TestResolution(string writerSchema, T actual, string readerSchema, S expected) @@ -300,89 +311,124 @@ private static void testResolutionMismatch(string writerSchema, T value, stri deserialize(ms, ws, Schema.Parse(readerSchema)); } - [TestCase("boolean", true, "null", ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "boolean", ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "string", ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "bytes", ExpectedException = typeof(AvroException))] + [TestCase("boolean", true, "null", typeof(AvroException))] + [TestCase("int", 10, "boolean", typeof(AvroException))] + [TestCase("int", 10, "string", typeof(AvroException))] + [TestCase("int", 10, "bytes", typeof(AvroException))] [TestCase("int", 10, "{\"type\":\"record\",\"name\":\"r\",\"fields\":[{\"name\":\"f\", \"type\":\"int\"}]}", - ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "{\"type\":\"enum\",\"name\":\"e\",\"symbols\":[\"s\", \"t\"]}", ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "{\"type\":\"array\",\"items\":\"int\"}", ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "{\"type\":\"map\",\"values\":\"int\"}", ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "[\"string\", \"bytes\"]", ExpectedException = typeof(AvroException))] - [TestCase("int", 10, "{\"type\":\"fixed\",\"name\":\"f\",\"size\":2}", ExpectedException = typeof(AvroException))] + typeof(AvroException))] + [TestCase("int", 10, "{\"type\":\"enum\",\"name\":\"e\",\"symbols\":[\"s\", \"t\"]}", typeof(AvroException))] + [TestCase("int", 10, "{\"type\":\"array\",\"items\":\"int\"}", typeof(AvroException))] + [TestCase("int", 10, "{\"type\":\"map\",\"values\":\"int\"}", typeof(AvroException))] + [TestCase("int", 10, "[\"string\", \"bytes\"]", typeof(AvroException))] + [TestCase("int", 10, "{\"type\":\"fixed\",\"name\":\"f\",\"size\":2}", typeof(AvroException))] [TestCase("{\"type\":\"array\",\"items\":\"int\"}", new int[] { 10 }, - "\"boolean\"", ExpectedException = typeof(AvroException))] + "\"boolean\"", typeof(AvroException))] [TestCase("{\"type\":\"array\",\"items\":\"int\"}", new int[] { 10 }, - "{\"type\":\"array\",\"items\":\"string\"}", ExpectedException = typeof(AvroException))] - [TestCase("[\"int\", \"boolean\"]", 10, "[\"string\", \"bytes\"]", ExpectedException = typeof(AvroException))] - [TestCase("[\"int\", \"boolean\"]", 10, "\"string\"", ExpectedException = typeof(AvroException))] - public void TestResolutionMismatch_simple(string writerSchema, object value, string readerSchema) + "{\"type\":\"array\",\"items\":\"string\"}", typeof(AvroException))] + [TestCase("[\"int\", \"boolean\"]", 10, "[\"string\", \"bytes\"]", typeof(AvroException))] + [TestCase("[\"int\", \"boolean\"]", 10, "\"string\"", typeof(AvroException))] + public void TestResolutionMismatch_simple(string writerSchema, object value, string readerSchema, Type expectedExceptionType = null) { - testResolutionMismatch(writerSchema, value, readerSchema); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { testResolutionMismatch(writerSchema, value, readerSchema); }); + } + else + { + testResolutionMismatch(writerSchema, value, readerSchema); + } } [TestCase("{\"type\":\"record\",\"name\":\"r\",\"fields\":" + "[{\"name\":\"f1\",\"type\":[\"int\", \"null\"]},{\"name\":\"f2\",\"type\":\"int\"}]}", new object[] { "f1", 101, "f2", 100 }, "int", - ExpectedException = typeof(AvroException), Description = "Non-record schema")] + typeof(AvroException), Description = "Non-record schema")] [TestCase("{\"type\":\"record\",\"name\":\"r\",\"fields\":" + "[{\"name\":\"f1\",\"type\":[\"int\", \"null\"]},{\"name\":\"f2\",\"type\":\"int\"}]}", new object[] { "f1", 101, "f2", 100 }, "{\"type\":\"record\",\"name\":\"s\",\"fields\":" + "[{\"name\":\"f2\",\"type\":\"int\"}]}", - ExpectedException = typeof(AvroException), Description = "Name mismatch")] + typeof(AvroException), Description = "Name mismatch")] [TestCase("{\"type\":\"record\",\"name\":\"r\",\"fields\":" + "[{\"name\":\"f1\",\"type\":[\"int\", \"null\"]},{\"name\":\"f2\",\"type\":\"int\"}]}", new object[] { "f1", 101, "f2", 100 }, "{\"type\":\"record\",\"name\":\"r\",\"fields\":" + "[{\"name\":\"f2\",\"type\":\"string\"}]}", - ExpectedException = typeof(AvroException), Description = "incompatible field")] + typeof(AvroException), Description = "incompatible field")] [TestCase("{\"type\":\"record\",\"name\":\"r\",\"fields\":" + "[{\"name\":\"f1\",\"type\":[\"int\", \"null\"]},{\"name\":\"f2\",\"type\":\"int\"}]}", new object[] { "f1", 101, "f2", 100 }, "{\"type\":\"record\",\"name\":\"r\",\"fields\":" + "[{\"name\":\"f3\",\"type\":\"string\"}]}", - ExpectedException = typeof(AvroException), Description = "new field without default")] - public void TestResolutionMismatch_record(string ws, object[] actual, string rs) + typeof(AvroException), Description = "new field without default")] + public void TestResolutionMismatch_record(string ws, object[] actual, string rs, Type expectedExceptionType = null) { - testResolutionMismatch(ws, mkRecord(actual, Schema.Parse(ws) as RecordSchema), rs); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { testResolutionMismatch(ws, mkRecord(actual, Schema.Parse(ws) as RecordSchema), rs); }); + } + else + { + testResolutionMismatch(ws, mkRecord(actual, Schema.Parse(ws) as RecordSchema), rs); + } } [TestCase("{\"type\":\"enum\",\"name\":\"e\",\"symbols\":[\"s\", \"t\"]}", "s", "int", - ExpectedException = typeof(AvroException), Description = "Non-enum schema")] + typeof(AvroException), Description = "Non-enum schema")] [TestCase("{\"type\":\"enum\",\"name\":\"e\",\"symbols\":[\"s\", \"t\"]}", "s", "{\"type\":\"enum\",\"name\":\"f\",\"symbols\":[\"s\", \"t\"]}", - ExpectedException = typeof(AvroException), Description = "Name mismatch")] + typeof(AvroException), Description = "Name mismatch")] [TestCase("{\"type\":\"enum\",\"name\":\"e\",\"symbols\":[\"s\", \"t\"]}", "s", "{\"type\":\"enum\",\"name\":\"f\",\"symbols\":[\"t\", \"u\"]}", - ExpectedException = typeof(AvroException), Description = "Incompatible symbols")] - public void TestResolutionMismatch_enum(string ws, string value, string rs) + typeof(AvroException), Description = "Incompatible symbols")] + public void TestResolutionMismatch_enum(string ws, string value, string rs, Type expectedExceptionType = null) { - testResolutionMismatch(ws, mkEnum(ws, value), rs); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { testResolutionMismatch(ws, mkEnum(ws, value), rs); }); + } + else + { + testResolutionMismatch(ws, mkEnum(ws, value), rs); + } } [TestCase("{\"type\":\"map\",\"values\":\"int\"}", new object[] { "a", 0 }, "int", - ExpectedException = typeof(AvroException), Description = "Non-map schema")] + typeof(AvroException), Description = "Non-map schema")] [TestCase("{\"type\":\"map\",\"values\":\"int\"}", new object[] { "a", 0 }, "{\"type\":\"map\",\"values\":\"string\"}", - ExpectedException = typeof(AvroException), Description = "Name mismatch")] - public void TestResolutionMismatch_map(string ws, object[] value, string rs) + typeof(AvroException), Description = "Name mismatch")] + public void TestResolutionMismatch_map(string ws, object[] value, string rs, Type expectedExceptionType = null) { - testResolutionMismatch(ws, mkMap(value), rs); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { testResolutionMismatch(ws, mkMap(value), rs); }); + } + else + { + testResolutionMismatch(ws, mkMap(value), rs); + } } [TestCase("{\"type\":\"fixed\",\"name\":\"f\",\"size\":2}", new byte[] { 1, 1 }, "int", - ExpectedException = typeof(AvroException), Description = "Non-fixed schema")] + typeof(AvroException), Description = "Non-fixed schema")] [TestCase("{\"type\":\"fixed\",\"name\":\"f\",\"size\":2}", new byte[] { 1, 1 }, "{\"type\":\"fixed\",\"name\":\"g\",\"size\":2}", - ExpectedException = typeof(AvroException), Description = "Name mismatch")] + typeof(AvroException), Description = "Name mismatch")] [TestCase("{\"type\":\"fixed\",\"name\":\"f\",\"size\":2}", new byte[] { 1, 1 }, "{\"type\":\"fixed\",\"name\":\"f\",\"size\":1}", - ExpectedException = typeof(AvroException), Description = "Size mismatch")] - public void TestResolutionMismatch_fixed(string ws, byte[] value, string rs) + typeof(AvroException), Description = "Size mismatch")] + public void TestResolutionMismatch_fixed(string ws, byte[] value, string rs, Type expectedExceptionType = null) { - testResolutionMismatch(ws, mkFixed(ws, value), rs); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { testResolutionMismatch(ws, mkFixed(ws, value), rs); }); + } + else + { + testResolutionMismatch(ws, mkFixed(ws, value), rs); + } } [Test] diff --git a/lang/csharp/src/apache/test/Protocol/ProtocolTest.cs b/lang/csharp/src/apache/test/Protocol/ProtocolTest.cs index 19eeee8b3c9..453d2ed1b06 100644 --- a/lang/csharp/src/apache/test/Protocol/ProtocolTest.cs +++ b/lang/csharp/src/apache/test/Protocol/ProtocolTest.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -49,7 +49,7 @@ public class ProtocolTest ""errors"": [""Curse"", ""CurseMore""] } } -}", true)] +}", true, TestName = "TestProtocol0")] [TestCase(@"{ ""protocol"" : ""MyProtocol"", ""namespace"" : ""com.foo"", @@ -107,7 +107,7 @@ public class ProtocolTest ""type"" : ""int"" } ] -}", true)] +}", true, TestName = "TestProtocol1")] [TestCase(@"{ ""protocol"" : ""MyProtocol"", ""namespace"" : ""com.bar"", @@ -168,7 +168,7 @@ public class ProtocolTest ""type"" : ""int"" } ] -}", true)] +}", true, TestName = "TestProtocol2")] public static void TestProtocol(string str, bool valid) { Protocol protocol = Protocol.Parse(str); @@ -221,7 +221,7 @@ public static void TestProtocol(string str, bool valid) } } }", - true,true)] + true,true, TestName = "TestProtocolHash_ProtocolsMatch")] // Protocols match, order of schemas in 'types' are different [TestCase( @"{ @@ -262,7 +262,7 @@ public static void TestProtocol(string str, bool valid) } } }", - false,true)] + false,true, TestName = "TestProtocolHash_ProtocolsMatch_OrderOfSchemasInTypesAreDifferent")] // Name of protocol is different [TestCase( @"{ @@ -303,7 +303,7 @@ public static void TestProtocol(string str, bool valid) } } }", - false,false)] + false,false, TestName = "TestProtocolHash_NameOfProtocolIsDifferent")] // Name of a message request is different: 'hi' [TestCase( @"{ @@ -344,7 +344,7 @@ public static void TestProtocol(string str, bool valid) } } }", - false,false)] + false,false, TestName = "TestProtocolHash_NameOfMessageRequestIsDifferent")] // Name of a type is different : Curse1 [TestCase( @"{ @@ -385,7 +385,7 @@ public static void TestProtocol(string str, bool valid) } } }", - false,false)] + false,false, TestName = "TestProtocolHash_NameOfTypeIsDifferent_Curse1")] // Name of a record field is different: 'mymessage' [TestCase( @"{ @@ -426,7 +426,7 @@ public static void TestProtocol(string str, bool valid) } } }", - false,false)] + false,false, TestName = "TestProtocolHash_NameOfRecordFieldIsDifferent_MyMessage")] public static void TestProtocolHash(string str1, string str2, bool md5_equal, bool hash_equal) { Protocol protocol1 = Protocol.Parse(str1); diff --git a/lang/csharp/src/apache/test/Schema/AliasTest.cs b/lang/csharp/src/apache/test/Schema/AliasTest.cs index 96dec9ebca0..c480076d32a 100644 --- a/lang/csharp/src/apache/test/Schema/AliasTest.cs +++ b/lang/csharp/src/apache/test/Schema/AliasTest.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -143,64 +143,64 @@ public void TestFixedAliasesResolution(string reader, string writer, bool canrea @"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", - true)] + true, TestName = "TestRecordAliasesResolution1")] [TestCase(2,@"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", @"{""type"":""record"",""name"":""NewRec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", - false)] + false, TestName = "TestRecordAliasesResolution2")] [TestCase(3,@"{""type"":""record"",""name"":""Rec"", ""aliases"":[""NewRec""], ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", @"{""type"":""record"",""name"":""NewRec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", - true)] + true, TestName = "TestRecordAliasesResolution3")] [TestCase(4,@"{""type"":""record"",""name"":""Rec"", ""aliases"":[""OtherRec"",""DiffRec""], ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", @"{""type"":""record"",""name"":""NewRec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", - false)] + false, TestName = "TestRecordAliasesResolution4")] [TestCase(5,@"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f3"",""type"": ""int""}]}", @"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", - false)] + false, TestName = "TestRecordAliasesResolution5")] [TestCase(6,@"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f3"",""type"": ""int"", ""aliases"":[""f2""]}]}", @"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", - true)] + true, TestName = "TestRecordAliasesResolution6")] [TestCase(7,@"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f3"",""type"": ""int"", ""aliases"":[""f4"",""f5""]}]}", @"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"":""long"" }, {""name"":""f2"",""type"": ""int""}]}", - false)] + false, TestName = "TestRecordAliasesResolution7")] [TestCase(8,@"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""Symbol"", ""symbols"":[""A""] }}]}", @"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }}]}", - false)] + false, TestName = "TestRecordAliasesResolution8")] [TestCase(9,@"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""NewSymbol""], ""symbols"":[""A""] }}]}", @"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }}]}", - true)] + true, TestName = "TestRecordAliasesResolution9")] [TestCase(10,@"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""DiffSymbol""], ""symbols"":[""A""] }}]}", @"{""type"":""record"",""name"":""Rec"", ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }}]}", - false)] + false, TestName = "TestRecordAliasesResolution10")] [TestCase(11,@"{""type"":""record"",""name"":""Rec"",""aliases"":[""NewRec""], ""fields"":[{""name"":""f2"",""aliases"":[""f1""],""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""NewSymbol""], ""symbols"":[""A""] }}, {""name"":""f3"",""aliases"":[""f4""],""type"": {""type"":""fixed"", ""name"":""Fixed"", ""aliases"":[""NewFixed""], ""size"": 1 }} @@ -209,7 +209,7 @@ public void TestFixedAliasesResolution(string reader, string writer, bool canrea ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A""] }}, {""name"":""f4"",""type"": {""type"":""fixed"", ""name"":""NewFixed"", ""size"": 1 }} ]}", - true)] + true, TestName = "TestRecordAliasesResolution11")] [TestCase(12,@"{""type"":""record"",""name"":""Rec"",""aliases"":[""NewRec""], ""fields"":[{""name"":""f2"",""aliases"":[""f1""],""type"": {""type"":""enum"", ""name"":""Symbol"", ""aliases"":[""NewSymbol""], ""symbols"":[""A""] }}, {""name"":""f3"",""aliases"":[""f4""],""type"": {""type"":""fixed"", ""name"":""Fixed"", ""aliases"":[""NewFixed""], ""size"":1 }} @@ -218,7 +218,7 @@ public void TestFixedAliasesResolution(string reader, string writer, bool canrea ""fields"":[{""name"":""f1"",""type"": {""type"":""enum"", ""name"":""NewSymbol"", ""symbols"":[""A"",""B""] }}, {""name"":""f4"",""type"": {""type"":""fixed"", ""name"":""NewFixed"", ""size"":1 }} ]}", - true)] + true, TestName = "TestRecordAliasesResolution12")] public void TestRecordAliasesResolution(int testid, string reader, string writer, bool canread) { diff --git a/lang/csharp/src/apache/test/Schema/SchemaNormalizationTests.cs b/lang/csharp/src/apache/test/Schema/SchemaNormalizationTests.cs index c3b0cd1ad4a..f097715b429 100644 --- a/lang/csharp/src/apache/test/Schema/SchemaNormalizationTests.cs +++ b/lang/csharp/src/apache/test/Schema/SchemaNormalizationTests.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -50,7 +50,9 @@ public void FingerprintTest(string input, string expectedOutput) private static List ProvideFingerprintTestCases() { - using (StreamReader reader = new StreamReader("../../../../../share/test/data/schema-tests.txt")) + var dir = Path.GetDirectoryName(new Uri(typeof(SchemaNormalizationTests).Assembly.CodeBase).LocalPath); + var testsPath = Path.Combine(dir, "../../../../../../../../share/test/data/schema-tests.txt"); + using (StreamReader reader = new StreamReader(testsPath)) { return CaseFinder.Find(reader, "fingerprint", new List()); } @@ -58,7 +60,9 @@ private static List ProvideFingerprintTestCases() private static List ProvideCanonicalTestCases() { - using (StreamReader reader = new StreamReader("../../../../../share/test/data/schema-tests.txt")) + var dir = Path.GetDirectoryName(new Uri(typeof(SchemaNormalizationTests).Assembly.CodeBase).LocalPath); + var testsPath = Path.Combine(dir, "../../../../../../../../share/test/data/schema-tests.txt"); + using (StreamReader reader = new StreamReader(testsPath)) { return CaseFinder.Find(reader, "canonical", new List()); } diff --git a/lang/csharp/src/apache/test/Schema/SchemaTests.cs b/lang/csharp/src/apache/test/Schema/SchemaTests.cs index 8e13087ef26..41db0a201c5 100644 --- a/lang/csharp/src/apache/test/Schema/SchemaTests.cs +++ b/lang/csharp/src/apache/test/Schema/SchemaTests.cs @@ -64,23 +64,23 @@ public class SchemaTests "\"fields\":[{\"name\":\"value\",\"type\":\"long\"},{\"name\":\"next\",\"type\":[\"LongList\",\"null\"]}]}")] // Recursive. [TestCase("{\"type\":\"record\",\"name\":\"LongList\"," + "\"fields\":[{\"name\":\"value\",\"type\":\"long\"},{\"name\":\"next\",\"type\":[\"LongListA\",\"null\"]}]}", - Description = "Unknown name", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "Unknown name")] [TestCase("{\"type\":\"record\",\"name\":\"LongList\"}", - Description = "No fields", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "No fields")] [TestCase("{\"type\":\"record\",\"name\":\"LongList\", \"fields\": \"hi\"}", - Description = "Fields not an array", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "Fields not an array")] [TestCase("[{\"type\": \"record\",\"name\": \"Test\",\"namespace\":\"ns1\",\"fields\": [{\"name\": \"f\",\"type\": \"long\"}]}," + "{\"type\": \"record\",\"name\": \"Test\",\"namespace\":\"ns2\",\"fields\": [{\"name\": \"f\",\"type\": \"long\"}]}]")] // Enum [TestCase("{\"type\": \"enum\", \"name\": \"Test\", \"symbols\": [\"A\", \"B\"]}")] [TestCase("{\"type\": \"enum\", \"name\": \"Status\", \"symbols\": \"Normal Caution Critical\"}", - Description = "Symbols not an array", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "Symbols not an array")] [TestCase("{\"type\": \"enum\", \"name\": [ 0, 1, 1, 2, 3, 5, 8 ], \"symbols\": [\"Golden\", \"Mean\"]}", - Description = "Name not a string", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "Name not a string")] [TestCase("{\"type\": \"enum\", \"symbols\" : [\"I\", \"will\", \"fail\", \"no\", \"name\"]}", - Description = "No name", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "No name")] [TestCase("{\"type\": \"enum\", \"name\": \"Test\", \"symbols\" : [\"AA\", \"AA\"]}", - Description = "Duplicate symbol", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "Duplicate symbol")] // Array [TestCase("{\"type\": \"array\", \"items\": \"long\"}")] @@ -93,22 +93,27 @@ public class SchemaTests // Union [TestCase("[\"string\", \"null\", \"long\"]")] [TestCase("[\"string\", \"long\", \"long\"]", - Description = "Duplicate type", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "Duplicate type")] [TestCase("[{\"type\": \"array\", \"items\": \"long\"}, {\"type\": \"array\", \"items\": \"string\"}]", - Description = "Duplicate type", ExpectedException = typeof(SchemaParseException))] + typeof(SchemaParseException), Description = "Duplicate type")] [TestCase("{\"type\":[\"string\", \"null\", \"long\"]}")] // Fixed [TestCase("{ \"type\": \"fixed\", \"name\": \"Test\", \"size\": 1}")] [TestCase("{\"type\": \"fixed\", \"name\": \"MyFixed\", \"namespace\": \"org.apache.hadoop.avro\", \"size\": 1}")] - [TestCase("{ \"type\": \"fixed\", \"name\": \"Test\", \"size\": 1}")] - [TestCase("{ \"type\": \"fixed\", \"name\": \"Test\", \"size\": 1}")] - [TestCase("{\"type\": \"fixed\", \"name\": \"Missing size\"}", ExpectedException = typeof(SchemaParseException))] + [TestCase("{\"type\": \"fixed\", \"name\": \"Missing size\"}", typeof(SchemaParseException))] [TestCase("{\"type\": \"fixed\", \"size\": 314}", - Description = "No name", ExpectedException = typeof(SchemaParseException))] - public void TestBasic(string s) + typeof(SchemaParseException), Description = "No name")] + public void TestBasic(string s, Type expectedExceptionType = null) { - Schema.Parse(s); + if (expectedExceptionType != null) + { + Assert.Throws(expectedExceptionType, () => { Schema.Parse(s); }); + } + else + { + Schema.Parse(s); + } } [TestCase("null", Schema.Type.Null)] @@ -305,7 +310,7 @@ public void TestFixedDoc(string s, string expectedDoc) Assert.AreEqual(expectedDoc, fs.Documentation); } - [TestCase("a", "o.a.h", Result = "o.a.h.a")] + [TestCase("a", "o.a.h", ExpectedResult = "o.a.h.a")] public string testFullname(string s1, string s2) { var name = new SchemaName(s1, s2, null); diff --git a/lang/csharp/src/apache/test/Specific/SpecificTests.cs b/lang/csharp/src/apache/test/Specific/SpecificTests.cs index aedf8f2b980..a88976e7476 100644 --- a/lang/csharp/src/apache/test/Specific/SpecificTests.cs +++ b/lang/csharp/src/apache/test/Specific/SpecificTests.cs @@ -31,6 +31,7 @@ namespace Avro.Test [TestFixture] class SpecificTests { +#if !NETCOREAPP2_0 // System.CodeDom compilation not supported in .NET Core: https://github.com/dotnet/corefx/issues/12180 // The dynamically created assembly used in the test below can only be created // once otherwise repeated tests will fail as the same type name will exist in // multiple assemblies and so the type in the test and the type found by ObjectCreator @@ -157,8 +158,7 @@ class SpecificTests myArray3.Add(o1); myArray3.Add(o2); -"} -)] +"}, TestName = "TestSpecific")] public void TestSpecific(string str, object[] result) { if(compres == null) @@ -191,7 +191,7 @@ public void TestSpecific(string str, object[] result) // compile var comparam = new CompilerParameters(new string[] { "mscorlib.dll" }); comparam.ReferencedAssemblies.Add("System.dll"); - comparam.ReferencedAssemblies.Add("Avro.dll"); + comparam.ReferencedAssemblies.Add(Path.Combine(TestContext.CurrentContext.TestDirectory, "Avro.dll")); comparam.GenerateInMemory = true; var ccp = new Microsoft.CSharp.CSharpCodeProvider(); var units = new CodeCompileUnit[] { compileUnit }; @@ -225,6 +225,7 @@ public void TestSpecific(string str, object[] result) Assert.IsFalse(rec2 == null); AssertSpecificRecordEqual(rec, rec2); } +#endif [TestCase] public void TestEnumResolution() diff --git a/lang/csharp/src/apache/test/Utils/CaseFinderTests.cs b/lang/csharp/src/apache/test/Utils/CaseFinderTests.cs index 1257863af6b..7b460969ceb 100644 --- a/lang/csharp/src/apache/test/Utils/CaseFinderTests.cs +++ b/lang/csharp/src/apache/test/Utils/CaseFinderTests.cs @@ -1,4 +1,4 @@ -/** +/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information @@ -72,7 +72,7 @@ public void TestOutput(string input, string label, List expectedOutput Assert.True(Eq(result, expectedOutput), Pr(result)); } - private List OutputTestCases() + private static List OutputTestCases() { List result = new List(); result.Add(new Object[] { "", "foo", new List { } }); @@ -82,7 +82,6 @@ private List OutputTestCases() result.Add(new Object[] { "< { new object[] { "a", "b" } } }); result.Add(new Object[] { "// This is a test\n< { new object[] { "a", "b" } } }); result.Add(new Object[] { "< { new object[] { "a", "b" } } }); - result.Add(new Object[] { "< { new object[] { "a", "b" } } }); result.Add(new Object[] { "< { new object[] { "a", "b\n" } } }); result.Add(new Object[] { "< { new object[] { "a", "\n b \n" } } }); result.Add(new Object[] { "< { new object[] { "a", "b" }, new object[] { "c", "d" } } }); diff --git a/pom.xml b/pom.xml index 8f0276eed42..7fa4f366060 100644 --- a/pom.xml +++ b/pom.xml @@ -264,7 +264,7 @@ lang/java/tools/src/test/compiler/output-string/Position.java lang/java/tools/src/test/compiler/output/Player.java lang/java/tools/src/test/compiler/output/Position.java - lang/csharp/src/apache/test/Ipc/GeneratedFiles/**/*.cs + lang/csharp/src/apache/ipc.test/GeneratedFiles/**/*.cs lang/csharp/src/apache/perf/com/foo/*.cs lang/csharp/src/apache/ipc/org/apache/avro/ipc/*.cs lang/java/mapred/src/test/resources/org/apache/avro/mapreduce/mapreduce-test-input.txt @@ -319,7 +319,7 @@ lang/perl/Changes lang/c/README.maintaining_win32.txt lang/c/docs/index.txt - lang/csharp/README + lang/csharp/README.md lang/java/archetypes/avro-service-archetype/src/test/integration/projects/basic/archetype.properties lang/py/lib/simplejson/** diff --git a/share/docker/Dockerfile b/share/docker/Dockerfile index bbf675cd207..ca27195c031 100644 --- a/share/docker/Dockerfile +++ b/share/docker/Dockerfile @@ -28,6 +28,12 @@ RUN curl -sL https://deb.nodesource.com/setup_4.x | bash - # Install dependencies from packages RUN apt-get -qq update && \ + # Add the repository for Mono (https://www.mono-project.com/download/stable/#download-lin-debian) + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \ + apt-get -qq install -y apt-transport-https && \ + echo "deb https://download.mono-project.com/repo/debian stable-jessie main" | tee /etc/apt/sources.list.d/mono-official-stable.list && \ + apt-get -qq update && \ + # END Add the repository for Mono apt-get -qq install --no-install-recommends -y \ ant \ asciidoc \ @@ -50,8 +56,8 @@ RUN apt-get -qq update && \ make \ maven \ mono-devel \ + mono-complete \ nodejs \ - nunit \ perl \ php5 \ php5-gmp \ @@ -91,15 +97,6 @@ RUN curl -L http://cpanmin.us | perl - --self-upgrade && \ IO::String Object::Tiny Compress::Zlib Test::More \ Test::Exception Test::Pod -# Install mono modules -RUN mkdir -p /tmp/nunit/ && \ - cd /tmp/nunit/ && \ - curl -L -s -o nunit.zip https://github.com/nunit-legacy/nunitv2/releases/download/2.7.0/NUnit-2.7.0.zip && \ - unzip nunit.zip && \ - rm nunit.zip - -ENV MONO_PATH /tmp/nunit/bin/lib - # Install Ruby modules RUN gem install echoe yajl-ruby multi_json snappy