Compare commits

...

6 Commits

Author SHA1 Message Date
Stef Heyenrath
454051568a 1.0.3.20 2018-05-29 22:01:15 +02:00
Stef Heyenrath
2b498f45cb Revert PortUtil.cs changes (#147) 2018-05-29 21:58:56 +02:00
Stef Heyenrath
2fcfda49c7 Update changelog 2018-05-28 15:13:34 +02:00
Stef Heyenrath
7ef0c1d68b 1.0.3.19 2018-05-28 08:43:41 +02:00
Bob Paul
297743a19a Fix code for .NET Core 2 so that server has cancellation token, and Stop method waits for shutdown. This resolves issues when using .NET Core 2 and starting/stopping server instances. (#145) 2018-05-28 08:30:18 +02:00
Stef Heyenrath
0640c88bcd Fix ConcurrentDictionary (#129) (#144) 2018-05-28 08:08:18 +02:00
10 changed files with 40 additions and 22 deletions

View File

@@ -1,3 +1,21 @@
# 1.0.3.20 (29 May 2018)
- [#147](https://github.com/WireMock-Net/WireMock.Net/pull/147) - Revert PortUtil.cs changes contributed by Stef Heyenrath ([StefH](https://github.com/StefH))
- [#146](https://github.com/WireMock-Net/WireMock.Net/issues/146) - Hang possibly due to Windows firewall prompt
- [#129](https://github.com/WireMock-Net/WireMock.Net/issues/129) - Random test failures between WireMock.Net 1.0.3.1 and 1.0.3.2
Commits: 2fcfda49c7...2b498f45cb
# 1.0.3.19 (28 May 2018)
- [#129](https://github.com/WireMock-Net/WireMock.Net/issues/129) - Random test failures between WireMock.Net 1.0.3.1 and 1.0.3.2
- [#145](https://github.com/WireMock-Net/WireMock.Net/pull/145) - Cancellation token not passed to server instance in .NET Core 2 contributed by Bob Paul ([Bob11327](https://github.com/Bob11327)) +fix
- [#144](https://github.com/WireMock-Net/WireMock.Net/pull/144) - Fix ConcurrentDictionary (#129) contributed by Stef Heyenrath ([StefH](https://github.com/StefH))
Commits: ...
# 1.0.3.18 (25 May 2018)
- [#142](https://github.com/WireMock-Net/WireMock.Net/pull/142) - Allow all headers to be set as Response headers contributed by Stef Heyenrath ([StefH](https://github.com/StefH))

View File

@@ -1,5 +1,5 @@
https://github.com/GitTools/GitReleaseNotes
GitReleaseNotes.exe . /OutputFile CHANGELOG.md /Version 1.0.3.18
GitReleaseNotes.exe . /OutputFile CHANGELOG.md /Version 1.0.3.20
GitReleaseNotes.exe . /OutputFile CHANGELOG.md /allTags

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Lightweight StandAlone Http Mocking Server for .Net.</Description>
<AssemblyTitle>WireMock.Net.StandAlone</AssemblyTitle>
<Version>1.0.3.18</Version>
<Version>1.0.3.20</Version>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net452;net46;netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>

View File

@@ -110,7 +110,7 @@ namespace WireMock.Owin
_host.Run(_cts.Token);
#else
_logger.Info("WireMock.Net server using netstandard2.0");
_host.Run();
_host.RunAsync(_cts.Token).Wait();
#endif
}
catch (Exception e)

View File

@@ -58,7 +58,7 @@ namespace WireMock.Owin
// Set start
if (!_options.Scenarios.ContainsKey(mapping.Scenario) && mapping.IsStartState)
{
_options.Scenarios.Add(mapping.Scenario, null);
_options.Scenarios.TryAdd(mapping.Scenario, null);
}
}

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using WireMock.Logging;
using WireMock.Matchers;
@@ -23,7 +22,9 @@ namespace WireMock.Owin
public bool AllowPartialMapping { get; set; }
public IDictionary<Guid, Mapping> Mappings { get; } = new ConcurrentDictionary<Guid, Mapping>();
public ConcurrentDictionary<Guid, Mapping> Mappings { get; } = new ConcurrentDictionary<Guid, Mapping>(); // Checked
public ConcurrentDictionary<string, object> Scenarios { get; } = new ConcurrentDictionary<string, object>(); // Checked
public ObservableCollection<LogEntry> LogEntries { get; } = new ConcurentObservableCollection<LogEntry>();
@@ -31,8 +32,6 @@ namespace WireMock.Owin
public int? MaxRequestLogCount { get; set; }
public IDictionary<string, object> Scenarios { get; } = new ConcurrentDictionary<string, object>();
#if !NETSTANDARD
public Action<IAppBuilder> PreWireMockMiddlewareInit { get; set; }

View File

@@ -1,5 +1,4 @@
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WireMock.Util;
@@ -8,14 +7,14 @@ using WireMock.Validation;
namespace WireMock
{
/// <summary>
/// The response.
/// The ResponseMessage.
/// </summary>
public class ResponseMessage
{
/// <summary>
/// Gets the headers.
/// </summary>
public IDictionary<string, WireMockList<string>> Headers { get; set; } = new ConcurrentDictionary<string, WireMockList<string>>();
public IDictionary<string, WireMockList<string>> Headers { get; set; } = new Dictionary<string, WireMockList<string>>();
/// <summary>
/// Gets or sets the status code.

View File

@@ -210,7 +210,7 @@ namespace WireMock.Server
if (settings.SaveMapping)
{
var mapping = ToMapping(requestMessage, responseMessage, settings.BlackListedHeaders ?? new string[] { });
_options.Mappings.Add(mapping.Guid, mapping);
_options.Mappings.TryAdd(mapping.Guid, mapping);
if (settings.SaveMappingToFile)
{
@@ -577,7 +577,7 @@ namespace WireMock.Server
#region Scenarios
private ResponseMessage ScenariosGet(RequestMessage requestMessage)
{
var scenarios = Scenarios.Select(s => new
var scenarios = Scenarios.ToArray().Select(s => new
{
Name = s.Key,
Started = s.Value != null,

View File

@@ -56,7 +56,7 @@ namespace WireMock.Server
/// Gets the scenarios.
/// </summary>
[PublicAPI]
public IDictionary<string, object> Scenarios => new ConcurrentDictionary<string, object>(_options.Scenarios);
public ConcurrentDictionary<string, object> Scenarios => new ConcurrentDictionary<string, object>(_options.Scenarios); // Checked
#region Start/Stop
/// <summary>
@@ -248,7 +248,9 @@ namespace WireMock.Server
[PublicAPI]
public void Stop()
{
_httpServer?.StopAsync();
var result = _httpServer?.StopAsync();
if (result != null)
result.Wait(); //wait for stop to actually happen
}
#endregion
@@ -292,9 +294,9 @@ namespace WireMock.Server
[PublicAPI]
public void ResetMappings()
{
foreach (var nonAdmin in _options.Mappings.Where(m => !m.Value.IsAdminInterface))
foreach (var nonAdmin in _options.Mappings.ToArray().Where(m => !m.Value.IsAdminInterface))
{
_options.Mappings.Remove(nonAdmin);
_options.Mappings.TryRemove(nonAdmin.Key, out _);
}
}
@@ -308,7 +310,7 @@ namespace WireMock.Server
// Check a mapping exists with the same GUID, if so, remove it.
if (_options.Mappings.ContainsKey(guid))
{
return _options.Mappings.Remove(guid);
return _options.Mappings.TryRemove(guid, out _);
}
return false;
@@ -317,7 +319,7 @@ namespace WireMock.Server
private bool DeleteMapping(string path)
{
// Check a mapping exists with the same path, if so, remove it.
var mapping = _options.Mappings.FirstOrDefault(entry => string.Equals(entry.Value.Path, path, StringComparison.OrdinalIgnoreCase));
var mapping = _options.Mappings.ToArray().FirstOrDefault(entry => string.Equals(entry.Value.Path, path, StringComparison.OrdinalIgnoreCase));
return DeleteMapping(mapping.Key);
}
@@ -415,7 +417,7 @@ namespace WireMock.Server
}
else
{
_options.Mappings.Add(mapping.Guid, mapping);
_options.Mappings.TryAdd(mapping.Guid, mapping);
}
}
}

View File

@@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Lightweight Http Mocking Server for .Net, inspired by WireMock from the Java landscape.</Description>
<AssemblyTitle>WireMock.Net</AssemblyTitle>
<Version>1.0.3.18</Version>
<Version>1.0.3.20</Version>
<Authors>Stef Heyenrath</Authors>
<TargetFrameworks>net452;net46;netstandard1.3;netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>