mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-03-06 06:20:08 +01:00
Compare commits
1 Commits
1.0.4.21
...
CommandLin
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
43177d45c3 |
@@ -1,13 +1,8 @@
|
|||||||
# 1.0.4.21 (30 November 2018)
|
# 1.0.4.21 (09 November 2018)
|
||||||
- [#221](https://github.com/WireMock-Net/WireMock.Net/pull/221) - Update dependencies [feature] contributed by [StefH](https://github.com/StefH)
|
- [#221](https://github.com/WireMock-Net/WireMock.Net/pull/221) - Update dependencies [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#229](https://github.com/WireMock-Net/WireMock.Net/pull/229) - Fix proxy tests [test] contributed by [StefH](https://github.com/StefH)
|
- [#229](https://github.com/WireMock-Net/WireMock.Net/pull/229) - Fix proxy tests [test] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#230](https://github.com/WireMock-Net/WireMock.Net/pull/230) - Add HandleBars Random functionality (#219) [feature] contributed by [StefH](https://github.com/StefH)
|
- [#230](https://github.com/WireMock-Net/WireMock.Net/pull/230) - Add HandleBars Random functionality (#219) [feature] contributed by [StefH](https://github.com/StefH)
|
||||||
- [#231](https://github.com/WireMock-Net/WireMock.Net/pull/231) - Use RandomDataGenerator.Net 1.0.3.0 contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#232](https://github.com/WireMock-Net/WireMock.Net/pull/232) - Add SonarLint checks [feature] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#233](https://github.com/WireMock-Net/WireMock.Net/pull/233) - RandomDataGenerator.Net 1.0.4 [feature] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#235](https://github.com/WireMock-Net/WireMock.Net/pull/235) - Check aggregate exception during startup [bug] contributed by [StefH](https://github.com/StefH)
|
|
||||||
- [#219](https://github.com/WireMock-Net/WireMock.Net/issues/219) - Feature: random value helper [feature]
|
- [#219](https://github.com/WireMock-Net/WireMock.Net/issues/219) - Feature: random value helper [feature]
|
||||||
- [#234](https://github.com/WireMock-Net/WireMock.Net/issues/234) - Timeout Exception on VSTS Test Platform (Azure DevOps), with private build agent
|
|
||||||
|
|
||||||
# 1.0.4.20 (07 November 2018)
|
# 1.0.4.20 (07 November 2018)
|
||||||
- [#222](https://github.com/WireMock-Net/WireMock.Net/pull/222) - Codecov contributed by [StefH](https://github.com/StefH)
|
- [#222](https://github.com/WireMock-Net/WireMock.Net/pull/222) - Codecov contributed by [StefH](https://github.com/StefH)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>1.0.4.21</VersionPrefix>
|
<VersionPrefix>1.0.4.20</VersionPrefix>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Choose>
|
<Choose>
|
||||||
|
|||||||
32
src/WireMock.Net.StandAlone/CommandLineArguments.cs
Normal file
32
src/WireMock.Net.StandAlone/CommandLineArguments.cs
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
using CommandLineParser.Arguments;
|
||||||
|
|
||||||
|
namespace WireMock.Net.StandAlone
|
||||||
|
{
|
||||||
|
public class CommandLineArguments
|
||||||
|
{
|
||||||
|
[ValueArgument(typeof(bool), "StartAdminInterface", DefaultValue = true, Description = "Start the AdminInterface")]
|
||||||
|
public bool StartAdminInterface { get; set; }
|
||||||
|
|
||||||
|
[ValueArgument(typeof(bool), "ReadStaticMappings", DefaultValue = false, Description = "Read StaticMappings")]
|
||||||
|
public bool ReadStaticMappings { get; set; }
|
||||||
|
|
||||||
|
[ValueArgument(typeof(bool), 'w', "WatchStaticMappings", DefaultValue = false, Description = "Watch the static mapping files + folder for changes when running.")]
|
||||||
|
public bool WatchStaticMappings { get; set; }
|
||||||
|
|
||||||
|
[ValueArgument(typeof(bool), 'm', "AllowPartialMapping", DefaultValue = false, Description = "Allow PartialMapping")]
|
||||||
|
public bool AllowPartialMapping { get; set; }
|
||||||
|
|
||||||
|
[ValueArgument(typeof(string), 'u', "AdminUsername", Description = "The username needed for __admin access.")]
|
||||||
|
public string AdminUsername { get; set; }
|
||||||
|
|
||||||
|
[ValueArgument(typeof(string), 'p', "AdminPassword", Description = "The password needed for __admin access.")]
|
||||||
|
public string AdminPassword { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
[BoundedValueArgument(typeof(int), 'o', "MaxRequestLogCount", MinValue = 0, Description = "The Maximum number of RequestLogs to keep")]
|
||||||
|
public int MaxRequestLogCount { get; set; }
|
||||||
|
|
||||||
|
[BoundedValueArgument(typeof(int), 'x', "RequestLogExpirationDuration", MinValue = 0, Description = "The RequestLog Expiration Duration in hours")]
|
||||||
|
public int RequestLogExpirationDuration { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -38,8 +38,9 @@ namespace WireMock.Net.StandAlone
|
|||||||
{
|
{
|
||||||
Check.NotNull(args, nameof(args));
|
Check.NotNull(args, nameof(args));
|
||||||
|
|
||||||
var parser = new SimpleCommandLineParser();
|
var parser = new CommandLineParser.CommandLineParser();
|
||||||
parser.Parse(args);
|
var p = new CommandLineArguments();
|
||||||
|
parser.ExtractArgumentAttributes(p);
|
||||||
|
|
||||||
var settings = new FluentMockServerSettings
|
var settings = new FluentMockServerSettings
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -41,6 +41,11 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Remove="SimpleCommandLineParser.cs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommandLineArgumentsParser" Version="3.0.19" />
|
||||||
<PackageReference Include="JetBrains.Annotations" Version="2018.2.1">
|
<PackageReference Include="JetBrains.Annotations" Version="2018.2.1">
|
||||||
<PrivateAssets>All</PrivateAssets>
|
<PrivateAssets>All</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace WireMock.Exceptions
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// WireMockException
|
|
||||||
/// </summary>
|
|
||||||
/// <seealso cref="Exception" />
|
|
||||||
public class WireMockException : Exception
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="WireMockException"/> class.
|
|
||||||
/// </summary>
|
|
||||||
public WireMockException()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="WireMockException"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message">The message that describes the error.</param>
|
|
||||||
public WireMockException(string message) : base(message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="WireMockException"/> class.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message">The message.</param>
|
|
||||||
/// <param name="inner">The inner.</param>
|
|
||||||
public WireMockException(string message, Exception inner) : base(message, inner)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -102,6 +102,14 @@ namespace WireMock.Serialization
|
|||||||
mappingModel.Response.Headers = Map(response.ResponseMessage.Headers);
|
mappingModel.Response.Headers = Map(response.ResponseMessage.Headers);
|
||||||
mappingModel.Response.UseTransformer = response.UseTransformer;
|
mappingModel.Response.UseTransformer = response.UseTransformer;
|
||||||
|
|
||||||
|
MapBodyData(response, mappingModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mappingModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void MapBodyData(Response response, MappingModel mappingModel)
|
||||||
|
{
|
||||||
if (response.ResponseMessage.BodyData != null)
|
if (response.ResponseMessage.BodyData != null)
|
||||||
{
|
{
|
||||||
switch (response.ResponseMessage.BodyData?.DetectedBodyType)
|
switch (response.ResponseMessage.BodyData?.DetectedBodyType)
|
||||||
@@ -137,9 +145,6 @@ namespace WireMock.Serialization
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return mappingModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static IDictionary<string, object> Map(IDictionary<string, WireMockList<string>> dictionary)
|
private static IDictionary<string, object> Map(IDictionary<string, WireMockList<string>> dictionary)
|
||||||
{
|
{
|
||||||
if (dictionary == null || dictionary.Count == 0)
|
if (dictionary == null || dictionary.Count == 0)
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using WireMock.Exceptions;
|
|
||||||
using WireMock.Handlers;
|
using WireMock.Handlers;
|
||||||
using WireMock.Logging;
|
using WireMock.Logging;
|
||||||
using WireMock.Matchers;
|
using WireMock.Matchers;
|
||||||
@@ -214,27 +213,21 @@ namespace WireMock.Server
|
|||||||
#endif
|
#endif
|
||||||
Ports = _httpServer.Ports;
|
Ports = _httpServer.Ports;
|
||||||
|
|
||||||
var startTask = _httpServer.StartAsync();
|
_httpServer.StartAsync();
|
||||||
|
|
||||||
using (var ctsStartTimeout = new CancellationTokenSource(settings.StartTimeout))
|
using (var ctsStartTimeout = new CancellationTokenSource(settings.StartTimeout))
|
||||||
{
|
{
|
||||||
while (!_httpServer.IsStarted)
|
while (!_httpServer.IsStarted)
|
||||||
{
|
{
|
||||||
// Throw exception if service start fails
|
// Throw out exception if service start fails
|
||||||
if (_httpServer.RunningException != null)
|
if (_httpServer.RunningException != null)
|
||||||
{
|
{
|
||||||
throw new WireMockException($"Service start failed with error: {_httpServer.RunningException.Message}", _httpServer.RunningException);
|
throw new Exception($"Service start failed with error: {_httpServer.RunningException.Message}", _httpServer.RunningException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Respect start timeout setting by throwing TimeoutException
|
||||||
if (ctsStartTimeout.IsCancellationRequested)
|
if (ctsStartTimeout.IsCancellationRequested)
|
||||||
{
|
{
|
||||||
// In case of an aggregate exception, throw the exception.
|
|
||||||
if (startTask.Exception != null)
|
|
||||||
{
|
|
||||||
throw new WireMockException($"Service start failed with error: {startTask.Exception.Message}", startTask.Exception);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Else throw TimeoutException
|
|
||||||
throw new TimeoutException($"Service start timed out after {TimeSpan.FromMilliseconds(settings.StartTimeout)}");
|
throw new TimeoutException($"Service start timed out after {TimeSpan.FromMilliseconds(settings.StartTimeout)}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user