SEBWIN-301: Implemented scaffolding for service component and added CI build artifact for service.
This commit is contained in:
parent
be6332c336
commit
0bdf5d15e1
11 changed files with 308 additions and 1 deletions
17
SafeExamBrowser.Service.UnitTests/Properties/AssemblyInfo.cs
Normal file
17
SafeExamBrowser.Service.UnitTests/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,17 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("SafeExamBrowser.Service.UnitTests")]
|
||||
[assembly: AssemblyDescription("Safe Exam Browser")]
|
||||
[assembly: AssemblyCompany("ETH Zürich")]
|
||||
[assembly: AssemblyProduct("SafeExamBrowser.Service.UnitTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019 ETH Zürich, Educational Development and Technology (LET)")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("26c4aaee-3902-400c-a154-63a357dea2f8")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.0")]
|
|
@ -0,0 +1,67 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{26C4AAEE-3902-400C-A154-63A357DEA2F8}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SafeExamBrowser.Service.UnitTests</RootNamespace>
|
||||
<AssemblyName>SafeExamBrowser.Service.UnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
5
SafeExamBrowser.Service.UnitTests/packages.config
Normal file
5
SafeExamBrowser.Service.UnitTests/packages.config
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
|
||||
</packages>
|
6
SafeExamBrowser.Service/App.config
Normal file
6
SafeExamBrowser.Service/App.config
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
</configuration>
|
18
SafeExamBrowser.Service/CompositionRoot.cs
Normal file
18
SafeExamBrowser.Service/CompositionRoot.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
namespace SafeExamBrowser.Service
|
||||
{
|
||||
internal class CompositionRoot
|
||||
{
|
||||
internal void BuildObjectGraph()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
35
SafeExamBrowser.Service/Installer.cs
Normal file
35
SafeExamBrowser.Service/Installer.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace SafeExamBrowser.Service
|
||||
{
|
||||
[RunInstaller(true)]
|
||||
public class Installer : System.Configuration.Install.Installer
|
||||
{
|
||||
private ServiceProcessInstaller process;
|
||||
private ServiceInstaller service;
|
||||
|
||||
public Installer()
|
||||
{
|
||||
process = new ServiceProcessInstaller();
|
||||
process.Account = ServiceAccount.LocalSystem;
|
||||
|
||||
service = new ServiceInstaller();
|
||||
service.Description = "Performs operations which require elevated privileges.";
|
||||
service.DisplayName = "Safe Exam Browser Service";
|
||||
service.ServiceName = nameof(SafeExamBrowser.Service);
|
||||
service.StartType = ServiceStartMode.Automatic;
|
||||
|
||||
Installers.Add(process);
|
||||
Installers.Add(service);
|
||||
}
|
||||
}
|
||||
}
|
33
SafeExamBrowser.Service/Properties/AssemblyInfo.cs
Normal file
33
SafeExamBrowser.Service/Properties/AssemblyInfo.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("SafeExamBrowser.Service")]
|
||||
[assembly: AssemblyDescription("Safe Exam Browser")]
|
||||
[assembly: AssemblyCompany("ETH Zürich")]
|
||||
[assembly: AssemblyProduct("SafeExamBrowser.Service")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019 ETH Zürich, Educational Development and Technology (LET)")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("fa3c6692-dfed-4afa-bd58-9a3da2753c78")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyInformationalVersion("1.0.0.0")]
|
55
SafeExamBrowser.Service/SafeExamBrowser.Service.csproj
Normal file
55
SafeExamBrowser.Service/SafeExamBrowser.Service.csproj
Normal file
|
@ -0,0 +1,55 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>SafeExamBrowser.Service</RootNamespace>
|
||||
<AssemblyName>SafeExamBrowser.Service</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Configuration.Install" />
|
||||
<Reference Include="System.ServiceProcess" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CompositionRoot.cs" />
|
||||
<Compile Include="Installer.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Service.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
48
SafeExamBrowser.Service/Service.cs
Normal file
48
SafeExamBrowser.Service/Service.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2019 ETH Zürich, Educational Development and Technology (LET)
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
using System.ServiceProcess;
|
||||
|
||||
namespace SafeExamBrowser.Service
|
||||
{
|
||||
public class Service : ServiceBase
|
||||
{
|
||||
private CompositionRoot instances;
|
||||
|
||||
public Service()
|
||||
{
|
||||
CanPauseAndContinue = false;
|
||||
ServiceName = nameof(SafeExamBrowser.Service);
|
||||
}
|
||||
|
||||
public static void Main()
|
||||
{
|
||||
Run(new Service());
|
||||
}
|
||||
|
||||
protected override void OnStart(string[] args)
|
||||
{
|
||||
//instances = new CompositionRoot();
|
||||
//instances.BuildObjectGraph();
|
||||
//instances.LogStartupInformation();
|
||||
|
||||
//var success = instances.ServiceController.TryStart();
|
||||
|
||||
//if (!success)
|
||||
//{
|
||||
// Environment.Exit(-1);
|
||||
//}
|
||||
}
|
||||
|
||||
protected override void OnStop()
|
||||
{
|
||||
//instances?.ServiceController?.Terminate();
|
||||
//instances?.LogShutdownInformation();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -58,6 +58,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.UserInterfa
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.UserInterface.Shared", "SafeExamBrowser.UserInterface.Shared\SafeExamBrowser.UserInterface.Shared.csproj", "{38525928-87BA-4F8C-8010-4EB97BFAAE13}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Service", "SafeExamBrowser.Service\SafeExamBrowser.Service.csproj", "{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SafeExamBrowser.Service.UnitTests", "SafeExamBrowser.Service.UnitTests\SafeExamBrowser.Service.UnitTests.csproj", "{26C4AAEE-3902-400C-A154-63A357DEA2F8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
|
@ -242,6 +246,22 @@ Global
|
|||
{38525928-87BA-4F8C-8010-4EB97BFAAE13}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{38525928-87BA-4F8C-8010-4EB97BFAAE13}.Release|x86.ActiveCfg = Release|x86
|
||||
{38525928-87BA-4F8C-8010-4EB97BFAAE13}.Release|x86.Build.0 = Release|x86
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{FA3C6692-DFED-4AFA-BD58-9A3DA2753C78}.Release|x86.Build.0 = Release|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{26C4AAEE-3902-400C-A154-63A357DEA2F8}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -26,5 +26,8 @@ after_test:
|
|||
- codecov -f "coverage.xml"
|
||||
artifacts:
|
||||
- path: SafeExamBrowser.Runtime\bin\$(platform)\$(configuration)
|
||||
name: '$(appveyor_build_version)_Base'
|
||||
name: '$(appveyor_build_version)_Base_Application'
|
||||
type: zip
|
||||
- path: SafeExamBrowser.Service\bin\$(platform)\$(configuration)
|
||||
name: '$(appveyor_build_version)_Base_Service'
|
||||
type: zip
|
||||
|
|
Loading…
Reference in a new issue