Index: Ringtoets/Common/src/Ringtoets.Common.IO/Exporters/ConfigurationExporter.cs
===================================================================
diff -u
--- Ringtoets/Common/src/Ringtoets.Common.IO/Exporters/ConfigurationExporter.cs (revision 0)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Exporters/ConfigurationExporter.cs (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -0,0 +1,79 @@
+// 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 Core.Common.Base.IO;
+using Core.Common.IO.Exceptions;
+using Core.Common.Utils;
+using log4net;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.IO.Properties;
+using Ringtoets.Common.IO.Writers;
+
+namespace Ringtoets.Common.IO.Exporters
+{
+ ///
+ /// Base class for exporting a configuration and storing it as an XML file.
+ ///
+ public abstract class ConfigurationExporter : IFileExporter
+ where TCalculation : class, ICalculation
+ where TWriter : CalculationConfigurationWriter, new()
+ {
+ private static readonly ILog log = LogManager.GetLogger(typeof(ConfigurationExporter));
+ private readonly CalculationGroup calculationGroup;
+ private readonly string filePath;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The calculation group to export.
+ /// The path of the XML file to export to.
+ /// Thrown when is null.
+ /// Thrown when is invalid.
+ protected ConfigurationExporter(CalculationGroup calculationGroup, string filePath)
+ {
+ if (calculationGroup == null)
+ {
+ throw new ArgumentNullException(nameof(calculationGroup));
+ }
+
+ IOUtils.ValidateFilePath(filePath);
+
+ this.calculationGroup = calculationGroup;
+ this.filePath = filePath;
+ }
+
+ public bool Export()
+ {
+ try
+ {
+ new TWriter().Write(calculationGroup, filePath);
+ }
+ catch (CriticalFileWriteException e)
+ {
+ log.ErrorFormat(Resources.ConfigurationExporter_Export_Error_exception_0_no_configuration_exported, e.Message);
+ return false;
+ }
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -r8a00046f9112833f25944b0f2631c7003f7a1692 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8a00046f9112833f25944b0f2631c7003f7a1692)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -104,6 +104,15 @@
}
///
+ /// Looks up a localized string similar to {0} Er is geen configuratie geëxporteerd..
+ ///
+ public static string ConfigurationExporter_Export_Error_exception_0_no_configuration_exported {
+ get {
+ return ResourceManager.GetString("ConfigurationExporter_Export_Error_exception_0_no_configuration_exported", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to Het XML-document dat de configuratie voor de berekeningen beschrijft is niet geldig. De validatie geeft de volgende melding op regel {0}, positie {1}: {2}.
///
public static string ConfigurationReader_Configuration_contains_no_valid_xml_line_0_position_1_reason_2 {
@@ -1052,14 +1061,14 @@
}
///
- /// Looks up a localized string similar to BEGIN TRANSACTION;
- ///CREATE TABLE "TimeIntegrationSettings" (
- /// "LocationID" INTEGER NOT NULL,
- /// "CalculationTypeID" INTEGER NOT NULL,
- /// "TimeIntegrationSchemeID" INTEGER NOT NULL,
- /// CONSTRAINT timeintegrationsettings_pk PRIMARY KEY ("LocationID", "CalculationTypeID"),
- /// CONSTRAINT calculationtypes_timeintegrationsettings_fk FOREIGN KEY ("CalculationTypeID") REFERENCES CalculationTypes ("CalculationTypeID") ON DELETE NO ACTION ON UPDATE NO ACTION
- ///);
+ /// Looks up a localized string similar to BEGIN TRANSACTION;
+ ///CREATE TABLE "TimeIntegrationSettings" (
+ /// "LocationID" INTEGER NOT NULL,
+ /// "CalculationTypeID" INTEGER NOT NULL,
+ /// "TimeIntegrationSchemeID" INTEGER NOT NULL,
+ /// CONSTRAINT timeintegrationsettings_pk PRIMARY KEY ("LocationID", "CalculationTypeID"),
+ /// CONSTRAINT calculationtypes_timeintegrationsettings_fk FOREIGN KEY ("CalculationTypeID") REFERENCES CalculationTypes ("CalculationTypeID") ON DELETE NO ACTION ON UPDATE NO ACTION
+ ///);
///CREATE TABLE "Numeri [rest of string was truncated]";.
///
public static string settings_schema {
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx
===================================================================
diff -u -r8a00046f9112833f25944b0f2631c7003f7a1692 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision 8a00046f9112833f25944b0f2631c7003f7a1692)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Properties/Resources.resx (.../Resources.resx) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -513,6 +513,9 @@
Valideren van ingelezen data.
+
+ {0} Er is geen configuratie geëxporteerd.
+
..\Resources\ConfiguratieSchema.xsd;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8
Index: Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj
===================================================================
diff -u -r8a00046f9112833f25944b0f2631c7003f7a1692 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 8a00046f9112833f25944b0f2631c7003f7a1692)
+++ Ringtoets/Common/src/Ringtoets.Common.IO/Ringtoets.Common.IO.csproj (.../Ringtoets.Common.IO.csproj) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -61,6 +61,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj
===================================================================
diff -u -r0c0f67f67e9e0928a5dd756914167d1d23615187 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 0c0f67f67e9e0928a5dd756914167d1d23615187)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/Ringtoets.Common.Data.TestUtil.Test.csproj (.../Ringtoets.Common.Data.TestUtil.Test.csproj) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -58,6 +58,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestCalculationTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestCalculationTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil.Test/TestCalculationTest.cs (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -0,0 +1,41 @@
+// 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 NUnit.Framework;
+
+namespace Ringtoets.Common.Data.TestUtil.Test
+{
+ [TestFixture]
+ public class TestCalculationTest
+ {
+ [Test]
+ public void Constructor_WithName_NameSet()
+ {
+ // Call
+ var calculation = new TestCalculation("Name");
+
+ // Assert
+ Assert.AreEqual("Name", calculation.Name);
+ Assert.IsFalse(calculation.HasOutput);
+ Assert.IsNull(calculation.Comments);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj
===================================================================
diff -u -r0c0f67f67e9e0928a5dd756914167d1d23615187 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 0c0f67f67e9e0928a5dd756914167d1d23615187)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/Ringtoets.Common.Data.TestUtil.csproj (.../Ringtoets.Common.Data.TestUtil.csproj) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -60,6 +60,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculation.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculation.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.Data.TestUtil/TestCalculation.cs (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -0,0 +1,46 @@
+// 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 Core.Common.Base;
+using Ringtoets.Common.Data.Calculation;
+
+namespace Ringtoets.Common.Data.TestUtil
+{
+ ///
+ /// Simple calculation that can be used in tests.
+ ///
+ public class TestCalculation : Observable, ICalculation
+ {
+ ///
+ /// Creates a new .
+ ///
+ /// The name of the calculation.
+ public TestCalculation(string name)
+ {
+ Name = name;
+ }
+
+ public string Name { get; set; }
+ public bool HasOutput { get; }
+ public Comment Comments { get; }
+ public void ClearOutput() {}
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismPropertyChangeHandlerTest.cs
===================================================================
diff -u -r840a68b06516143729deb156261e247fbd9966d1 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismPropertyChangeHandlerTest.cs (.../FailureMechanismPropertyChangeHandlerTest.cs) (revision 840a68b06516143729deb156261e247fbd9966d1)
+++ Ringtoets/Common/test/Ringtoets.Common.Forms.Test/ChangeHandlers/FailureMechanismPropertyChangeHandlerTest.cs (.../FailureMechanismPropertyChangeHandlerTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -31,6 +31,7 @@
using Ringtoets.Common.Forms.ChangeHandlers;
using Ringtoets.Common.Forms.PropertyClasses;
using Ringtoets.Common.Forms.TestUtil;
+using TestCalculation = Ringtoets.Common.Forms.TestUtil.TestCalculation;
namespace Ringtoets.Common.Forms.Test.ChangeHandlers
{
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Exporters/ConfigurationExporterTest.cs
===================================================================
diff -u
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Exporters/ConfigurationExporterTest.cs (revision 0)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Exporters/ConfigurationExporterTest.cs (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -0,0 +1,182 @@
+// 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 System.IO;
+using System.Security.AccessControl;
+using System.Xml;
+using Core.Common.Base.IO;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Calculation;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.Common.IO.Writers;
+
+namespace Ringtoets.Common.IO.Test.Exporters
+{
+ [TestFixture]
+ public class ConfigurationExporterTest
+ {
+ [Test]
+ public void Constructor_ExpectedValues()
+ {
+ // Call
+ var exporter = new SimpleConfigurationExporter(new CalculationGroup(), "test.xml");
+
+ // Assert
+ Assert.IsInstanceOf(exporter);
+ }
+
+ [Test]
+ public void Constructor_CalculationGroupNull_ThrowArgumentNullException()
+ {
+ // Call
+ TestDelegate test = () => new SimpleConfigurationExporter(null, "test.xml");
+
+ // Assert
+ var exception = Assert.Throws(test);
+ Assert.AreEqual("calculationGroup", exception.ParamName);
+ }
+
+ [Test]
+ [TestCase("")]
+ [TestCase(" ")]
+ [TestCase("c:\\>")]
+ public void Constructor_FilePathInvalid_ThrowArgumentException(string filePath)
+ {
+ // Call
+ TestDelegate test = () => new SimpleConfigurationExporter(new CalculationGroup(), filePath);
+
+ // Assert
+ Assert.Throws(test);
+ }
+
+ [Test]
+ public void Export_ValidData_ReturnTrueAndWritesFile()
+ {
+ // Setup
+ string targetFilePath = TestHelper.GetScratchPadPath($"{nameof(Export_ValidData_ReturnTrueAndWritesFile)}.xml");
+
+ string testFileSubPath = Path.Combine(
+ nameof(ConfigurationExporter),
+ "folderWithSubfolderAndCalculation.xml");
+ string expectedXmlFilePath = TestHelper.GetTestDataPath(
+ TestDataPath.Ringtoets.Common.IO,
+ testFileSubPath);
+
+ var calculation = new TestCalculation("Calculation A");
+ var calculation2 = new TestCalculation("Calculation B");
+
+ var calculationGroup2 = new CalculationGroup("Group B", false)
+ {
+ Children =
+ {
+ calculation2
+ }
+ };
+
+ var calculationGroup = new CalculationGroup("Group A", false)
+ {
+ Children =
+ {
+ calculation,
+ calculationGroup2
+ }
+ };
+
+ var rootGroup = new CalculationGroup("root", false)
+ {
+ Children =
+ {
+ calculationGroup
+ }
+ };
+
+ var exporter = new SimpleConfigurationExporter(rootGroup, targetFilePath);
+
+ try
+ {
+ // Call
+ bool isExported = exporter.Export();
+
+ // Assert
+ Assert.IsTrue(isExported);
+ Assert.IsTrue(File.Exists(targetFilePath));
+
+ string actualXml = File.ReadAllText(targetFilePath);
+ string expectedXml = File.ReadAllText(expectedXmlFilePath);
+
+ Assert.AreEqual(expectedXml, actualXml);
+ }
+ finally
+ {
+ File.Delete(targetFilePath);
+ }
+ }
+
+ [Test]
+ public void Export_InvalidDirectoryRights_LogErrorAndReturnFalse()
+ {
+ // Setup
+ var calculationGroup = new CalculationGroup
+ {
+ Children =
+ {
+ new TestCalculation("Calculation A")
+ }
+ };
+
+ string directoryPath = TestHelper.GetScratchPadPath(nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse));
+ using (var disposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(Export_InvalidDirectoryRights_LogErrorAndReturnFalse)))
+ {
+ string filePath = Path.Combine(directoryPath, "test.xml");
+
+ var exporter = new SimpleConfigurationExporter(calculationGroup, filePath);
+
+ disposeHelper.LockDirectory(FileSystemRights.Write);
+
+ // Call
+ var isExported = true;
+ Action call = () => isExported = exporter.Export();
+
+ // Assert
+ string expectedMessage = $"Er is een onverwachte fout opgetreden tijdens het schrijven van het bestand '{filePath}'. "
+ + "Er is geen configuratie geëxporteerd.";
+ TestHelper.AssertLogMessageIsGenerated(call, expectedMessage);
+ Assert.IsFalse(isExported);
+ }
+ }
+ }
+
+ public class SimpleConfigurationExporter : ConfigurationExporter
+ {
+ public SimpleConfigurationExporter(CalculationGroup calculationGroup, string targetFilePath) : base(calculationGroup, targetFilePath) {}
+ }
+
+ public class SimpleCalculationConfigurationWriter : CalculationConfigurationWriter
+ {
+ protected override void WriteCalculation(TestCalculation calculation, XmlWriter writer)
+ {
+ writer.WriteElementString("calculation", calculation.Name);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj
===================================================================
diff -u -r2ab087c5f7b254eb7ea6d167b122afaea10b0ff6 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 2ab087c5f7b254eb7ea6d167b122afaea10b0ff6)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Ringtoets.Common.IO.Test.csproj (.../Ringtoets.Common.IO.Test.csproj) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -64,6 +64,7 @@
+
Index: Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/CalculationConfigurationWriterTest.cs
===================================================================
diff -u -r0e700dc5121b8f56c96d1d552056bbe6ebe29300 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/CalculationConfigurationWriterTest.cs (.../CalculationConfigurationWriterTest.cs) (revision 0e700dc5121b8f56c96d1d552056bbe6ebe29300)
+++ Ringtoets/Common/test/Ringtoets.Common.IO.Test/Writers/CalculationConfigurationWriterTest.cs (.../CalculationConfigurationWriterTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -24,14 +24,13 @@
using System.IO;
using System.Security.AccessControl;
using System.Xml;
-using Core.Common.Base;
using Core.Common.Base.Data;
using Core.Common.IO.Exceptions;
using Core.Common.TestUtil;
using NUnit.Framework;
-using Ringtoets.Common.Data;
using Ringtoets.Common.Data.Calculation;
using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.Common.Data.TestUtil;
using Ringtoets.Common.IO.Writers;
namespace Ringtoets.Common.IO.Test.Writers
@@ -206,24 +205,11 @@
}
}
- public class SimpleCalculation : Observable, ICalculation
+ public class SimpleCalculationConfigurationWriter : CalculationConfigurationWriter
{
- public SimpleCalculation(string name)
- {
- Name = name;
- }
-
- public string Name { get; set; }
- public bool HasOutput { get; }
- public Comment Comments { get; }
- public void ClearOutput() {}
- }
-
- public class SimpleCalculationConfigurationWriter : CalculationConfigurationWriter
- {
public const string CalculationElementTag = "calculation";
- protected override void WriteCalculation(SimpleCalculation calculation, XmlWriter writer)
+ protected override void WriteCalculation(TestCalculation calculation, XmlWriter writer)
{
writer.WriteElementString(CalculationElementTag, calculation.Name);
}
@@ -236,8 +222,8 @@
private static IEnumerable CalculationConfigurations()
{
- var calculation1 = new SimpleCalculation("calculation1");
- var calculation2 = new SimpleCalculation("calculation2");
+ var calculation1 = new TestCalculation("calculation1");
+ var calculation2 = new TestCalculation("calculation2");
var calculationGroup1 = new CalculationGroup("group1", false);
var calculationGroup2 = new CalculationGroup("group2", false)
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Forms.Test/PresentationObjects/GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs (.../GrassCoverErosionOutwardsWaveConditionsInputContextTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -31,6 +31,7 @@
using Ringtoets.GrassCoverErosionOutwards.Data;
using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects;
using Ringtoets.Revetment.Data;
+using TestCalculation = Ringtoets.Common.Forms.TestUtil.TestCalculation;
namespace Ringtoets.GrassCoverErosionOutwards.Forms.Test.PresentationObjects
{
Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/GrassCoverErosionOutwardsConfigurationExporterTest.cs
===================================================================
diff -u -r467a5dba1d4b29b2035d6d034a083125854077dc -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/GrassCoverErosionOutwardsConfigurationExporterTest.cs (.../GrassCoverErosionOutwardsConfigurationExporterTest.cs) (revision 467a5dba1d4b29b2035d6d034a083125854077dc)
+++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.IO.Test/GrassCoverErosionOutwardsConfigurationExporterTest.cs (.../GrassCoverErosionOutwardsConfigurationExporterTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -22,7 +22,6 @@
using System;
using System.IO;
using System.Security.AccessControl;
-using Core.Common.Base.Data;
using Core.Common.Base.IO;
using Core.Common.TestUtil;
using NUnit.Framework;
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingConfigurationExporter.cs
===================================================================
diff -u -r97c94a903e0fd98edd8cd4120340f91f06d3955c -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingConfigurationExporter.cs (.../PipingConfigurationExporter.cs) (revision 97c94a903e0fd98edd8cd4120340f91f06d3955c)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingConfigurationExporter.cs (.../PipingConfigurationExporter.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -20,58 +20,25 @@
// All rights reserved.
using System;
-using Core.Common.Base.IO;
-using Core.Common.IO.Exceptions;
-using Core.Common.Utils;
-using log4net;
using Ringtoets.Common.Data.Calculation;
-using Ringtoets.Piping.IO.Properties;
+using Ringtoets.Common.IO.Exporters;
+using Ringtoets.Piping.Data;
namespace Ringtoets.Piping.IO.Exporters
{
///
/// Exports a piping configuration and stores it as an XML file.
///
- public class PipingConfigurationExporter : IFileExporter
+ public class PipingConfigurationExporter : ConfigurationExporter
{
- private static readonly ILog log = LogManager.GetLogger(typeof(PipingConfigurationExporter));
-
- private readonly CalculationGroup calculationGroup;
- private readonly string filePath;
-
///
/// Creates a new instance of .
///
/// The calculation group to export.
/// The path of the XML file to export to.
/// Thrown when is null.
/// Thrown when is invalid.
- public PipingConfigurationExporter(CalculationGroup calculationGroup, string filePath)
- {
- if (calculationGroup == null)
- {
- throw new ArgumentNullException(nameof(calculationGroup));
- }
-
- IOUtils.ValidateFilePath(filePath);
-
- this.calculationGroup = calculationGroup;
- this.filePath = filePath;
- }
-
- public bool Export()
- {
- try
- {
- new PipingConfigurationWriter().Write(calculationGroup, filePath);
- }
- catch (CriticalFileWriteException e)
- {
- log.ErrorFormat(Resources.PipingConfigurationExporter_Export_Error_exception_0_no_configuration_exported, e.Message);
- return false;
- }
-
- return true;
- }
+ public PipingConfigurationExporter(CalculationGroup calculationGroup, string filePath) : base(calculationGroup, filePath)
+ {}
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingConfigurationWriter.cs
===================================================================
diff -u -r97c94a903e0fd98edd8cd4120340f91f06d3955c -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingConfigurationWriter.cs (.../PipingConfigurationWriter.cs) (revision 97c94a903e0fd98edd8cd4120340f91f06d3955c)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Exporters/PipingConfigurationWriter.cs (.../PipingConfigurationWriter.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -33,7 +33,7 @@
///
/// Writer for writing a piping configuration to XML.
///
- internal class PipingConfigurationWriter : CalculationConfigurationWriter
+ public class PipingConfigurationWriter : CalculationConfigurationWriter
{
protected override void WriteCalculation(PipingCalculation calculation, XmlWriter writer)
{
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs
===================================================================
diff -u -r8a00046f9112833f25944b0f2631c7003f7a1692 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 8a00046f9112833f25944b0f2631c7003f7a1692)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -215,15 +215,6 @@
}
///
- /// Looks up a localized string similar to {0} Er is geen configuratie geëxporteerd..
- ///
- public static string PipingConfigurationExporter_Export_Error_exception_0_no_configuration_exported {
- get {
- return ResourceManager.GetString("PipingConfigurationExporter_Export_Error_exception_0_no_configuration_exported", resourceCulture);
- }
- }
-
- ///
/// Looks up a localized string similar to {0}
///Er is geen berekeningenconfiguratie geïmporteerd..
///
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx
===================================================================
diff -u -r8a00046f9112833f25944b0f2631c7003f7a1692 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 8a00046f9112833f25944b0f2631c7003f7a1692)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Properties/Resources.resx (.../Resources.resx) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -260,9 +260,6 @@
{0}
Deze ondergrondschematisatie wordt overgeslagen.
-
- {0} Er is geen configuratie geëxporteerd.
-
Kan geen ondergrondmodellen lezen. Mogelijk bestaat de '{0}' tabel niet.
Index: Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/Revetment/test/Ringtoets.Revetment.Forms.Test/PropertyClasses/WaveConditionsInputContextPropertiesTest.cs (.../WaveConditionsInputContextPropertiesTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -43,6 +43,7 @@
using Ringtoets.Revetment.Data;
using Ringtoets.Revetment.Forms.PresentationObjects;
using Ringtoets.Revetment.Forms.PropertyClasses;
+using TestCalculation = Ringtoets.Common.Forms.TestUtil.TestCalculation;
namespace Ringtoets.Revetment.Forms.Test.PropertyClasses
{
Index: Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs (.../StabilityStoneCoverWaveConditionsInputContextTest.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/StabilityStoneCover/test/Ringtoets.StabilityStoneCover.Forms.Test/PresentationObjects/StabilityStoneCoverWaveConditionsInputContextTest.cs (.../StabilityStoneCoverWaveConditionsInputContextTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -34,6 +34,7 @@
using Ringtoets.Revetment.Forms.PresentationObjects;
using Ringtoets.StabilityStoneCover.Data;
using Ringtoets.StabilityStoneCover.Forms.PresentationObjects;
+using TestCalculation = Ringtoets.Common.Forms.TestUtil.TestCalculation;
namespace Ringtoets.StabilityStoneCover.Forms.Test.PresentationObjects
{
Index: Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs
===================================================================
diff -u -rba715436cd0186ee10a1edc13d547ee27bea4c89 -r5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526
--- Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs) (revision ba715436cd0186ee10a1edc13d547ee27bea4c89)
+++ Ringtoets/WaveImpactAsphaltCover/test/Ringtoets.WaveImpactAsphaltCover.Forms.Test/PresentationObjects/WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs (.../WaveImpactAsphaltCoverWaveConditionsInputContextTest.cs) (revision 5735c9b5c663a0bc7762d1b1eb1483e5c4cfe526)
@@ -34,6 +34,7 @@
using Ringtoets.Revetment.Forms.PresentationObjects;
using Ringtoets.WaveImpactAsphaltCover.Data;
using Ringtoets.WaveImpactAsphaltCover.Forms.PresentationObjects;
+using TestCalculation = Ringtoets.Common.Forms.TestUtil.TestCalculation;
namespace Ringtoets.WaveImpactAsphaltCover.Forms.Test.PresentationObjects
{