Index: Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs
===================================================================
diff -u -r75ac52f6f7e203e77dd212e6c32d68e7e58c28b2 -r8aea6e032ff8aeb4a4f1b85210fd0e2fbbce3a4a
--- Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 75ac52f6f7e203e77dd212e6c32d68e7e58c28b2)
+++ Ringtoets/Common/src/Ringtoets.Common.Service/WaveHeightCalculationService.cs (.../WaveHeightCalculationService.cs) (revision 8aea6e032ff8aeb4a4f1b85210fd0e2fbbce3a4a)
@@ -21,6 +21,7 @@
using System.IO;
using log4net;
+using Ringtoets.Common.Service.MessageProviders;
using Ringtoets.Common.Service.Properties;
using Ringtoets.HydraRing.Calculation.Data;
using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics;
@@ -43,13 +44,12 @@
/// Performs validation of the values in the given . Error information is logged during
/// the execution of the operation.
///
- /// The for which to validate the values.
+ /// The name to use in the validation logs.
/// The HLCD file that should be used for performing the calculation.
/// False if the connection to contains validation errors; True otherwise.
- internal static bool Validate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath)
+ internal static bool Validate(string name, string hydraulicBoundaryDatabaseFilePath)
{
- var calculationName = string.Format(Resources.WaveHeightCalculationService_Name_Wave_height_for_location_0_, hydraulicBoundaryLocation.Name);
- CalculationServiceHelper.LogValidationBeginTime(calculationName);
+ CalculationServiceHelper.LogValidationBeginTime(name);
string validationProblem = HydraulicDatabaseHelper.ValidatePathForCalculation(hydraulicBoundaryDatabaseFilePath);
var isValid = string.IsNullOrEmpty(validationProblem);
@@ -60,7 +60,7 @@
validationProblem);
}
- CalculationServiceHelper.LogValidationEndTime(calculationName);
+ CalculationServiceHelper.LogValidationEndTime(name);
return isValid;
}
@@ -69,12 +69,15 @@
/// Performs a wave height calculation based on the supplied and returns the result
/// if the calculation was successful. Error and status information is logged during the execution of the operation.
///
+ /// The message provider for the services.
/// The to perform the calculation for.
/// The HLCD file that should be used for performing the calculation.
/// The id of the ring to perform the calculation for.
/// The norm to use during the calculation.
/// A on a successful calculation, null otherwise.
- internal static ReliabilityIndexCalculationOutput Calculate(IHydraulicBoundaryLocation hydraulicBoundaryLocation, string hydraulicBoundaryDatabaseFilePath,
+ internal static ReliabilityIndexCalculationOutput Calculate(ICalculationMessageProvider messageProvider,
+ IHydraulicBoundaryLocation hydraulicBoundaryLocation,
+ string hydraulicBoundaryDatabaseFilePath,
string ringId, double norm)
{
var hlcdDirectory = Path.GetDirectoryName(hydraulicBoundaryDatabaseFilePath);
@@ -96,17 +99,17 @@
targetProbabilityCalculationParser
});
- VerifyOutput(targetProbabilityCalculationParser.Output, hydraulicBoundaryLocation.Name);
+ VerifyOutput(targetProbabilityCalculationParser.Output, messageProvider, hydraulicBoundaryLocation.Name);
});
return targetProbabilityCalculationParser.Output;
}
- private static void VerifyOutput(ReliabilityIndexCalculationOutput output, string name)
+ private static void VerifyOutput(ReliabilityIndexCalculationOutput output, ICalculationMessageProvider messageProvider, string locationName)
{
if (output == null)
{
- log.ErrorFormat(Resources.WaveHeightCalculationService_Calculate_Error_in_wave_height_0_calculation, name);
+ log.Error(messageProvider.GetCalculationFailedMessage(locationName));
}
}