From 2acfcc0a305e2f03b8252be37ae5251c65521411 Mon Sep 17 00:00:00 2001 From: Martin Regen Date: Fri, 12 Jan 2018 15:09:00 +0100 Subject: [PATCH] add mono client test --- .travis.yml | 2 + .../UA Client Controls.csproj | 14 +----- .../ClientControls.Net4/packages.config | 6 --- .../MonoConsoleClient.csproj | 27 +++++++++++ .../NetCoreConsoleClient.csproj | 4 ++ .../Samples/NetCoreConsoleClient/Program.cs | 4 +- .../Opc.Ua.MonoSampleServer.Config.xml | 2 +- .../Samples/NetCoreConsoleServer/Program.cs | 8 +--- .../ConsoleReferenceServer/Program.cs | 10 ++-- ...Quickstarts.MonoReferenceServer.Config.xml | 2 +- appveyor.yml | 2 +- testclientserver.sh | 6 +-- testmonoclientserver.sh | 47 +++++++++++++++++++ 13 files changed, 95 insertions(+), 39 deletions(-) delete mode 100644 SampleApplications/Samples/ClientControls.Net4/packages.config create mode 100644 SampleApplications/Samples/NetCoreConsoleClient/MonoConsoleClient.csproj create mode 100644 testmonoclientserver.sh diff --git a/.travis.yml b/.travis.yml index 0af384a91b..c35f8af1d7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -51,6 +51,8 @@ script: - msbuild /p:configuration=Release /t:compile,publish SampleApplications/Samples/NetCoreConsoleServer/MonoConsoleServer.csproj - cd SampleApplications/Samples/NetCoreConsoleServer/bin/Debug/net46 - mono MonoConsoleServer.exe -t 10 -a + - cd $TRAVIS_BUILD_DIR + - ./testmonoclientserver.sh after_script: - echo "========== build done ============" diff --git a/SampleApplications/Samples/ClientControls.Net4/UA Client Controls.csproj b/SampleApplications/Samples/ClientControls.Net4/UA Client Controls.csproj index 156e0a7dff..afda1bcce2 100644 --- a/SampleApplications/Samples/ClientControls.Net4/UA Client Controls.csproj +++ b/SampleApplications/Samples/ClientControls.Net4/UA Client Controls.csproj @@ -69,18 +69,9 @@ 3.0 - - ..\..\..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll - - - ..\..\..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll - - - ..\..\..\packages\System.Xml.XmlDocument.4.3.0\lib\net46\System.Xml.XmlDocument.dll - @@ -1022,9 +1013,6 @@ Designer - - Designer - @@ -1054,4 +1042,4 @@ - + \ No newline at end of file diff --git a/SampleApplications/Samples/ClientControls.Net4/packages.config b/SampleApplications/Samples/ClientControls.Net4/packages.config deleted file mode 100644 index f878e28bab..0000000000 --- a/SampleApplications/Samples/ClientControls.Net4/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/SampleApplications/Samples/NetCoreConsoleClient/MonoConsoleClient.csproj b/SampleApplications/Samples/NetCoreConsoleClient/MonoConsoleClient.csproj new file mode 100644 index 0000000000..6d7aa361aa --- /dev/null +++ b/SampleApplications/Samples/NetCoreConsoleClient/MonoConsoleClient.csproj @@ -0,0 +1,27 @@ + + + + net46 + MonoConsoleClient + Exe + MonoConsoleClient + OPC Foundation + OPC UA SDK + Mono Console Client + Copyright © 2004-2018 OPC Foundation, Inc + + + + + + + + + + + + + + + + diff --git a/SampleApplications/Samples/NetCoreConsoleClient/NetCoreConsoleClient.csproj b/SampleApplications/Samples/NetCoreConsoleClient/NetCoreConsoleClient.csproj index 4d446e2787..b20cc63abd 100644 --- a/SampleApplications/Samples/NetCoreConsoleClient/NetCoreConsoleClient.csproj +++ b/SampleApplications/Samples/NetCoreConsoleClient/NetCoreConsoleClient.csproj @@ -5,6 +5,10 @@ NetCoreConsoleClient Exe NetCoreConsoleClient + OPC Foundation + OPC UA SDK + .Net Core Console Client + Copyright © 2004-2018 OPC Foundation, Inc diff --git a/SampleApplications/Samples/NetCoreConsoleClient/Program.cs b/SampleApplications/Samples/NetCoreConsoleClient/Program.cs index 68ee99f8cb..2d967ddc70 100644 --- a/SampleApplications/Samples/NetCoreConsoleClient/Program.cs +++ b/SampleApplications/Samples/NetCoreConsoleClient/Program.cs @@ -77,7 +77,9 @@ namespace NetCoreConsoleClient if (showHelp) { // show some app description message - Console.WriteLine("Usage: dotnet NetCoreConsoleClient.dll [OPTIONS] [ENDPOINTURL]"); + Console.WriteLine(Utils.IsRunningOnMono() ? + "Usage: mono MonoConsoleClient.exe [OPTIONS] [ENDPOINTURL]" : + "Usage: dotnet NetCoreConsoleClient.dll [OPTIONS] [ENDPOINTURL]"); Console.WriteLine(); // output the options diff --git a/SampleApplications/Samples/NetCoreConsoleServer/Opc.Ua.MonoSampleServer.Config.xml b/SampleApplications/Samples/NetCoreConsoleServer/Opc.Ua.MonoSampleServer.Config.xml index e5d9511c2d..e7c3dabe01 100644 --- a/SampleApplications/Samples/NetCoreConsoleServer/Opc.Ua.MonoSampleServer.Config.xml +++ b/SampleApplications/Samples/NetCoreConsoleServer/Opc.Ua.MonoSampleServer.Config.xml @@ -209,7 +209,7 @@ - ./Opc.Ua.SampleServer.log.txt + ./Opc.Ua.MonoSampleServer.log.txt true diff --git a/SampleApplications/Samples/NetCoreConsoleServer/Program.cs b/SampleApplications/Samples/NetCoreConsoleServer/Program.cs index 0d4f5b4b4d..d58f28a0c7 100644 --- a/SampleApplications/Samples/NetCoreConsoleServer/Program.cs +++ b/SampleApplications/Samples/NetCoreConsoleServer/Program.cs @@ -105,7 +105,7 @@ namespace NetCoreConsoleServer if (showHelp) { - Console.WriteLine("Usage: dotnet NetCoreConsoleServer.dll [OPTIONS]"); + Console.WriteLine(Utils.IsRunningOnMono() ? "Usage: mono MonoConsoleServer.exe [OPTIONS]" : "Usage: dotnet NetCoreConsoleServer.dll [OPTIONS]" ); Console.WriteLine(); Console.WriteLine("Options:"); @@ -210,11 +210,7 @@ namespace NetCoreConsoleServer application.ApplicationName = "UA Core Sample Server"; application.ApplicationType = ApplicationType.Server; -#if NET46 - application.ConfigSectionName = "Opc.Ua.MonoSampleServer"; -#else - application.ConfigSectionName = "Opc.Ua.SampleServer"; -#endif + application.ConfigSectionName = Utils.IsRunningOnMono() ? "Opc.Ua.MonoSampleServer" : "Opc.Ua.SampleServer"; // load the application configuration. ApplicationConfiguration config = await application.LoadApplicationConfiguration(false); diff --git a/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Program.cs b/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Program.cs index 7780a0ac65..a524b44b50 100644 --- a/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Program.cs +++ b/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Program.cs @@ -91,7 +91,7 @@ namespace Quickstarts.ReferenceServer { public static int Main(string[] args) { - Console.WriteLine(".Net Core OPC UA Reference Server"); + Console.WriteLine("{0} OPC UA Reference Server", Utils.IsRunningOnMono() ? "Mono" : ".Net Core"); // command line options bool showHelp = false; @@ -119,7 +119,7 @@ namespace Quickstarts.ReferenceServer if (showHelp) { - Console.WriteLine("Usage: dotnet ConsoleReferenceServer.dll [OPTIONS]"); + Console.WriteLine(Utils.IsRunningOnMono() ? "Usage: mono MonoReferenceServer.exe [OPTIONS]" : "Usage: dotnet ConsoleReferenceServer.dll [OPTIONS]"); Console.WriteLine(); Console.WriteLine("Options:"); @@ -223,11 +223,7 @@ namespace Quickstarts.ReferenceServer application.ApplicationName = "Quickstart Reference Server"; application.ApplicationType = ApplicationType.Server; -#if NET46 - application.ConfigSectionName = "Quickstarts.MonoReferenceServer"; -#else - application.ConfigSectionName = "Quickstarts.ReferenceServer"; -#endif + application.ConfigSectionName = Utils.IsRunningOnMono() ? "Quickstarts.MonoReferenceServer" : "Quickstarts.ReferenceServer"; // load the application configuration. ApplicationConfiguration config = await application.LoadApplicationConfiguration(false); diff --git a/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Quickstarts.MonoReferenceServer.Config.xml b/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Quickstarts.MonoReferenceServer.Config.xml index 03b3c3fde8..34597439f1 100644 --- a/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Quickstarts.MonoReferenceServer.Config.xml +++ b/SampleApplications/Workshop/Reference/ConsoleReferenceServer/Quickstarts.MonoReferenceServer.Config.xml @@ -15,7 +15,7 @@ Directory ./OPC Foundation/PKI/own - CN=Quickstart Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost + CN=Quickstart Mono Reference Server, C=US, S=Arizona, O=OPC Foundation, DC=localhost diff --git a/appveyor.yml b/appveyor.yml index be252b3e8c..11ddbc6809 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ #---------------------------------# # version format -version: 1.3.350.{build}-{branch} +version: 1.3.351.{build}-{branch} # branches to build diff --git a/testclientserver.sh b/testclientserver.sh index 3c2c295898..ca6159ca8e 100755 --- a/testclientserver.sh +++ b/testclientserver.sh @@ -1,5 +1,5 @@ #!/bin/bash -echo Test the console server and console client +echo Test the .Net Core console server and console client workdir=$(pwd) testresult=0 @@ -13,9 +13,9 @@ cd $workdir cd SampleApplications/Samples/NetCoreConsoleClient echo build client -dotnet build +dotnet build NetCoreConsoleServer.csproj echo start client -dotnet run --no-restore --no-build -t 20 & +dotnet run --no-restore --no-build --project NetCoreConsoleServer.csproj -t 20 & clientpid="$!" cd $workdir diff --git a/testmonoclientserver.sh b/testmonoclientserver.sh new file mode 100644 index 0000000000..da61be0f29 --- /dev/null +++ b/testmonoclientserver.sh @@ -0,0 +1,47 @@ +#!/bin/bash +echo Test the Mono console server and console client +workdir=$(pwd) +testresult=0 + +cd SampleApplications/Samples/NetCoreConsoleServer +echo build server +msbuild /p:configuration=Debug /t:restore,compile MonoConsoleServer.csproj +echo start server +cd SampleApplications/Samples/NetCoreConsoleServer/bin/Debug/net46 +mono MonoConsoleServer.exe -t 60 -a & +serverpid="$!" +cd $workdir + +cd SampleApplications/Samples/NetCoreConsoleClient +echo build client +msbuild /p:configuration=Debug /t:restore,compile MonoConsoleClient.csproj +echo start client +cd SampleApplications/Samples/NetCoreConsoleClient/bin/Debug/net46 +mono MonoConsoleClient.exe -t 20 & +clientpid="$!" +cd $workdir + +echo wait for client +wait $clientpid +if [ $? -eq 0 ]; then + echo "SUCCESS - Client test passed" +else + testresult=$? + echo "FAILED - Client test failed with a status of $testresult" +fi + +echo wait for server +wait $serverpid +serverresult=$? + +if [ $? -eq 0 ]; then + echo "SUCCESS - Server test passed" +else + testresult=$? + echo "FAILED - Server test failed with a status of $testresult" +fi + +exit $testresult + + +