Handlebars Extension (#286)

* wip

* HandlebarsRegistrationCallback

* HandlebarsContextFactoryTests

* 1.0.21.0

* fix sonar

* LocalFileSystemHandler

* readme

* Fix System.IO.IOException
This commit is contained in:
Stef Heyenrath
2019-07-03 18:37:22 +02:00
committed by GitHub
parent 653e03fcd9
commit 93682c9bbf
37 changed files with 366 additions and 208 deletions

View File

@@ -1,6 +1,5 @@
using System.IO;
using JetBrains.Annotations;
using System.Threading;
using JetBrains.Annotations;
using WireMock.Handlers;
using WireMock.Validation;
@@ -11,16 +10,19 @@ namespace WireMock.Util
private const int NumberOfRetries = 3;
private const int DelayOnRetry = 500;
public static string ReadAllTextWithRetryAndDelay([NotNull] IFileSystemHandler handler, [NotNull] string path)
public static bool TryReadMappingFileWithRetryAndDelay([NotNull] IFileSystemHandler handler, [NotNull] string path, out string value)
{
Check.NotNull(handler, nameof(handler));
Check.NotNullOrEmpty(path, nameof(path));
value = null;
for (int i = 1; i <= NumberOfRetries; ++i)
{
try
{
return handler.ReadMappingFile(path);
value = handler.ReadMappingFile(path);
return true;
}
catch
{
@@ -28,7 +30,7 @@ namespace WireMock.Util
}
}
throw new IOException();
return false;
}
}
}