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")]
|
[YamlMember(Alias = "id")]
|
||||||
public string? ExtensionId { get; set; }
|
public string? ExtensionId { get; set; }
|
||||||
|
|
||||||
[YamlMember(Alias = "classname")]
|
[YamlMember(Alias = "className")]
|
||||||
public string? ExtensionClassName { get; set; }
|
public string? ExtensionClassName { get; set; }
|
||||||
|
|
||||||
[YamlMember(Alias = "enabled")]
|
[YamlMember(Alias = "enabled")]
|
||||||
|
|
|
@ -56,7 +56,7 @@ arguments: >-
|
||||||
extensions:
|
extensions:
|
||||||
- id: killRunawayProcess
|
- id: killRunawayProcess
|
||||||
enabled: yes
|
enabled: yes
|
||||||
classname: ""{this.testExtension}""
|
className: ""{this.testExtension}""
|
||||||
settings:
|
settings:
|
||||||
pidfile: 'foo/bar/pid.txt'
|
pidfile: 'foo/bar/pid.txt'
|
||||||
stopTimeOut: 5000
|
stopTimeOut: 5000
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using WinSW;
|
using WinSW;
|
||||||
|
using WinSW.Configuration;
|
||||||
using WinSW.Extensions;
|
using WinSW.Extensions;
|
||||||
using WinSW.Plugins.SharedDirectoryMapper;
|
using WinSW.Plugins.SharedDirectoryMapper;
|
||||||
|
|
||||||
|
@ -8,7 +9,8 @@ namespace winswTests.Extensions
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
class SharedDirectoryMapperTest : ExtensionTestBase
|
class SharedDirectoryMapperTest : ExtensionTestBase
|
||||||
{
|
{
|
||||||
ServiceDescriptor _testServiceDescriptor;
|
IWinSWConfiguration _testServiceDescriptor;
|
||||||
|
IWinSWConfiguration _testServiceDescriptorYaml;
|
||||||
|
|
||||||
readonly string testExtension = GetExtensionClassNameWithAssembly(typeof(SharedDirectoryMapper));
|
readonly string testExtension = GetExtensionClassNameWithAssembly(typeof(SharedDirectoryMapper));
|
||||||
|
|
||||||
|
@ -39,6 +41,44 @@ $@"<service>
|
||||||
</extensions>
|
</extensions>
|
||||||
</service>";
|
</service>";
|
||||||
this._testServiceDescriptor = ServiceDescriptor.FromXML(seedXml);
|
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]
|
[Test]
|
||||||
|
@ -49,6 +89,14 @@ $@"<service>
|
||||||
Assert.AreEqual(2, manager.Extensions.Count, "Two extensions should be loaded");
|
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]
|
[Test]
|
||||||
public void StartStopExtension()
|
public void StartStopExtension()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue