Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj
===================================================================
diff -u -r94a8886b6ba34f9c005ddb7b1e949dfdde8634f2 -r938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 94a8886b6ba34f9c005ddb7b1e949dfdde8634f2)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Ringtoets.HydraRing.Calculation.csproj (.../Ringtoets.HydraRing.Calculation.csproj) (revision 938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb)
@@ -46,6 +46,7 @@
+
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/HydraRingActivityFactory.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/HydraRingActivityFactory.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/HydraRingActivityFactory.cs (revision 938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb)
@@ -0,0 +1,55 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using Ringtoets.HydraRing.Calculation.Data;
+using Ringtoets.HydraRing.Calculation.Data.Input;
+using Ringtoets.HydraRing.Calculation.Data.Output;
+
+namespace Ringtoets.HydraRing.Calculation.Service
+{
+ ///
+ /// Factory for creating Hydra-Ring activities.
+ ///
+ public static class HydraRingActivityFactory
+ {
+ ///
+ /// Creates a new instance of the class.
+ ///
+ /// The name of the activity.
+ /// The directory of the HLCD file that should be used for performing the calculation.
+ /// The id of the ring to perform the calculation for.
+ /// The to use while executing the calculation.
+ /// The to use while executing the calculation.
+ /// The input of the calculation to perform.
+ /// The action to perform after the calculation is performed.
+ public static TargetProbabilityCalculationActivity Create(string name,
+ string hlcdDirectory,
+ string ringId,
+ HydraRingTimeIntegrationSchemeType timeIntegrationSchemeType,
+ HydraRingUncertaintiesType uncertaintiesType,
+ TargetProbabilityCalculationInput targetProbabilityCalculationInput,
+ Action handleCalculationOutputAction)
+ {
+ return new TargetProbabilityCalculationActivity(name, hlcdDirectory, ringId, timeIntegrationSchemeType, uncertaintiesType, targetProbabilityCalculationInput, handleCalculationOutputAction);
+ }
+ }
+}
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/TargetProbabilityCalculationActivity.cs
===================================================================
diff -u -rc4299b2d817120139d3a79f08342ccf74b399c6d -r938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/TargetProbabilityCalculationActivity.cs (.../TargetProbabilityCalculationActivity.cs) (revision c4299b2d817120139d3a79f08342ccf74b399c6d)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Calculation/Service/TargetProbabilityCalculationActivity.cs (.../TargetProbabilityCalculationActivity.cs) (revision 938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb)
@@ -51,7 +51,7 @@
/// The to use while executing the calculation.
/// The input of the calculation to perform.
/// The action to perform after the calculation is performed.
- public TargetProbabilityCalculationActivity(
+ internal TargetProbabilityCalculationActivity(
string name,
string hlcdDirectory,
string ringId,
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (revision 0)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Integration/HydraRingConfigurationServiceIntegrationTest.cs (revision 938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb)
@@ -0,0 +1,95 @@
+// Copyright (C) Stichting Deltares 2016. All rights reserved.
+//
+// This file is part of Ringtoets.
+//
+// Ringtoets is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see .
+//
+// All names, logos, and references to "Deltares" are registered trademarks of
+// Stichting Deltares and remain full property of Stichting Deltares at all times.
+// All rights reserved.
+
+using System;
+using NUnit.Framework;
+using Ringtoets.HydraRing.Calculation.Data;
+using Ringtoets.HydraRing.Calculation.Data.Input.Hydraulics;
+using Ringtoets.HydraRing.Calculation.Service;
+
+namespace Ringtoets.HydraRing.Calculation.Test.Integration
+{
+ [TestFixture]
+ public class HydraRingConfigurationServiceIntegrationTest
+ {
+ [Test]
+ public void GenerateDataBaseCreationScript_HydraRingConfigurationWithAssessmentLevelCalculation_ReturnsExpectedCreationScript()
+ {
+ var hydraRingConfigurationService = new HydraRingConfigurationService("34-1", HydraRingTimeIntegrationSchemeType.FBC, HydraRingUncertaintiesType.All);
+
+ hydraRingConfigurationService.AddHydraRingCalculationInput(new AssessmentLevelCalculationInput(700004, 10000));
+
+ var expectedCreationScript = "DELETE FROM [HydraulicModels];" + Environment.NewLine +
+ "INSERT INTO [HydraulicModels] VALUES (1, 1, 'WTI 2017');" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Sections];" + Environment.NewLine +
+ "INSERT INTO [Sections] VALUES (700004, 1, 1, '700004', '700004', 0, 0, 0, 0, 700004, 700004, 100, 0, 0);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [DesignTables];" + Environment.NewLine +
+ "INSERT INTO [DesignTables] VALUES (700004, 1, 1, 1, 2, 26, 0, 0, 0, 0, 0, 50, 3.71901648545568);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Numerics];" + Environment.NewLine +
+ "INSERT INTO [Numerics] VALUES (700004, 1, 1, 1, 1, 1, 4, 50, 0.15, 0.01, 0.01, 0.01, 2, 1, 20000, 100000, 0.1, -6, 6, 25);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [VariableDatas];" + Environment.NewLine +
+ "INSERT INTO [VariableDatas] VALUES (700004, 1, 1, 1, 26, 0, 0, 0, 0, 0, 0, 0, 0, 300);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [CalculationProfiles];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [SectionFaultTreeModels];" + Environment.NewLine +
+ "INSERT INTO [SectionFaultTreeModels] VALUES (700004, 1, 1, 1, 1);" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [SectionSubMechanismModels];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Fetches];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [AreaPoints];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [PresentationSections];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Profiles];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [ForelandModels];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Forelands];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [ProbabilityAlternatives];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [SetUpHeights];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [CalcWindDirections];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Swells];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [WaveReductions];" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Areas];" + Environment.NewLine +
+ "INSERT INTO [Areas] VALUES (1, '1', 'Nederland');" + Environment.NewLine +
+ Environment.NewLine +
+ "DELETE FROM [Projects];" + Environment.NewLine +
+ "INSERT INTO [Projects] VALUES (1, 'WTI 2017', 'Ringtoets calculation');" + Environment.NewLine;
+
+ var creationScript = hydraRingConfigurationService.GenerateDataBaseCreationScript();
+
+ Assert.AreEqual(expectedCreationScript, creationScript);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj
===================================================================
diff -u -r89d667f1f34413f7478f37de3bb4585817dc3c13 -r938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 89d667f1f34413f7478f37de3bb4585817dc3c13)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Ringtoets.HydraRing.Calculation.Test.csproj (.../Ringtoets.HydraRing.Calculation.Test.csproj) (revision 938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb)
@@ -60,7 +60,7 @@
-
+
Fisheye: Tag 938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb refers to a dead (removed) revision in file `Ringtoets/HydraRing/test/Ringtoets.HydraRing.Calculation.Test/Service/HydraRingConfigurationServiceIntegrationTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs
===================================================================
diff -u -ra10f78cf8ff03594c931cbcc227c6f7008a5154c -r938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision a10f78cf8ff03594c931cbcc227c6f7008a5154c)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 938e3cf3c4fb8d0f64f21ef4b0d6f5b45feb23bb)
@@ -447,18 +447,19 @@
(sender, args) =>
{
var hlcdDirectory = Path.GetDirectoryName(nodeData.Parent.HydraulicBoundaryDatabase.FilePath);
- var activities = nodeData.Parent.HydraulicBoundaryDatabase.Locations.Select(hbl => new TargetProbabilityCalculationActivity(
- string.Format(Resources.RingtoetsGuiPlugin_Calculate_assessment_level_for_location_0_, hbl.Id),
- hlcdDirectory,
- "",
- HydraRingTimeIntegrationSchemeType.FBC,
- HydraRingUncertaintiesType.All,
- new AssessmentLevelCalculationInput((int) hbl.Id, nodeData.Parent.FailureMechanismContribution.Norm),
- output =>
- {
- hbl.DesignWaterLevel = output.Result;
- hbl.NotifyObservers();
- })).ToList();
+ var activities = nodeData.Parent.HydraulicBoundaryDatabase.Locations
+ .Select(hbl => HydraRingActivityFactory.Create(
+ string.Format(Resources.RingtoetsGuiPlugin_Calculate_assessment_level_for_location_0_, hbl.Id),
+ hlcdDirectory,
+ "",
+ HydraRingTimeIntegrationSchemeType.FBC,
+ HydraRingUncertaintiesType.All,
+ new AssessmentLevelCalculationInput((int) hbl.Id, nodeData.Parent.FailureMechanismContribution.Norm),
+ output =>
+ {
+ hbl.DesignWaterLevel = output.Result;
+ hbl.NotifyObservers();
+ })).ToList();
ActivityProgressDialogRunner.Run(Gui.MainWindow, activities);
}