mirror of https://github.com/winsw/winsw
Add unit test for SharedDirectoryMapper yaml config
parent
566fc7e145
commit
362ea03104
|
@ -9,7 +9,7 @@ namespace WinSW.Configuration
|
|||
[YamlMember(Alias = "id")]
|
||||
public string? ExtensionId { get; set; }
|
||||
|
||||
[YamlMember(Alias = "classname")]
|
||||
[YamlMember(Alias = "className")]
|
||||
public string? ExtensionClassName { get; set; }
|
||||
|
||||
[YamlMember(Alias = "enabled")]
|
||||
|
|
|
@ -56,7 +56,7 @@ arguments: >-
|
|||
extensions:
|
||||
- id: killRunawayProcess
|
||||
enabled: yes
|
||||
classname: ""{this.testExtension}""
|
||||
className: ""{this.testExtension}""
|
||||
settings:
|
||||
pidfile: 'foo/bar/pid.txt'
|
||||
stopTimeOut: 5000
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using NUnit.Framework;
|
||||
using WinSW;
|
||||
using WinSW.Configuration;
|
||||
using WinSW.Extensions;
|
||||
using WinSW.Plugins.SharedDirectoryMapper;
|
||||
|
||||
|
@ -8,7 +9,8 @@ namespace winswTests.Extensions
|
|||
[TestFixture]
|
||||
class SharedDirectoryMapperTest : ExtensionTestBase
|
||||
{
|
||||
ServiceDescriptor _testServiceDescriptor;
|
||||
IWinSWConfiguration _testServiceDescriptor;
|
||||
IWinSWConfiguration _testServiceDescriptorYaml;
|
||||
|
||||
readonly string testExtension = GetExtensionClassNameWithAssembly(typeof(SharedDirectoryMapper));
|
||||
|
||||
|
@ -39,6 +41,44 @@ $@"<service>
|
|||
</extensions>
|
||||
</service>";
|
||||
this._testServiceDescriptor = ServiceDescriptor.FromXML(seedXml);
|
||||
|
||||
string seedYaml = $@"---
|
||||
id: jenkins
|
||||
name: Jenkins
|
||||
description: This service runs Jenkins automation server.
|
||||
env:
|
||||
-
|
||||
name: JENKINS_HOME
|
||||
value: '%LocalAppData%\Jenkins.jenkins'
|
||||
executable: java
|
||||
arguments: >-
|
||||
-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle
|
||||
-jar E:\Winsw Test\yml6\jenkins.war --httpPort=8081
|
||||
extensions:
|
||||
- id: mapNetworDirs
|
||||
className: ""{this.testExtension}""
|
||||
enabled: true
|
||||
settings:
|
||||
mapping:
|
||||
- enabled: false
|
||||
label: N
|
||||
uncpath: \\UNC
|
||||
- enabled: false
|
||||
label: M
|
||||
uncpath: \\UNC2
|
||||
- id: mapNetworDirs2
|
||||
className: ""{this.testExtension}""
|
||||
enabled: true
|
||||
settings:
|
||||
mapping:
|
||||
- enabled: false
|
||||
label: X
|
||||
uncpath: \\UNC
|
||||
- enabled: false
|
||||
label: Y
|
||||
uncpath: \\UNC2";
|
||||
|
||||
this._testServiceDescriptorYaml = ServiceDescriptorYaml.FromYaml(seedYaml).Configurations;
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -49,6 +89,14 @@ $@"<service>
|
|||
Assert.AreEqual(2, manager.Extensions.Count, "Two extensions should be loaded");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LoadExtensionsYaml()
|
||||
{
|
||||
WinSWExtensionManager manager = new WinSWExtensionManager(this._testServiceDescriptorYaml);
|
||||
manager.LoadExtensions();
|
||||
Assert.AreEqual(2, manager.Extensions.Count, "Two extensions should be loaded");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void StartStopExtension()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue