Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -rcbe83a33648625a849a8f4afdd28a6d2f9bc4179 -r0a1800fa11da26bf8304e59cb3a46bd6b0a0af60
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision cbe83a33648625a849a8f4afdd28a6d2f9bc4179)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 0a1800fa11da26bf8304e59cb3a46bd6b0a0af60)
@@ -322,6 +322,15 @@
}
///
+ /// Looks up a localized string similar to sqlite.
+ ///
+ public static string HydraulicBoundaryDatabase_FilePath_Extension {
+ get {
+ return ResourceManager.GetString("HydraulicBoundaryDatabase_FilePath_Extension", resourceCulture);
+ }
+ }
+
+ ///
/// Looks up a localized string similar to U heeft een ander hydraulische belastingendatabase bestand geselecteerd. Als gevolg hiervan moet de uitvoer van alle ervan afhankelijke berekeningen verwijderd worden.
///
///Wilt u doorgaan?.
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx
===================================================================
diff -u -rcbe83a33648625a849a8f4afdd28a6d2f9bc4179 -r0a1800fa11da26bf8304e59cb3a46bd6b0a0af60
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision cbe83a33648625a849a8f4afdd28a6d2f9bc4179)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 0a1800fa11da26bf8304e59cb3a46bd6b0a0af60)
@@ -223,4 +223,7 @@
Wilt u doorgaan?
+
+ sqlite
+
\ No newline at end of file
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs
===================================================================
diff -u -ra199966cb016dd5596430ada947e252d5b6b62e7 -r0a1800fa11da26bf8304e59cb3a46bd6b0a0af60
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision a199966cb016dd5596430ada947e252d5b6b62e7)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision 0a1800fa11da26bf8304e59cb3a46bd6b0a0af60)
@@ -1,4 +1,4 @@
-// Copyright (C) Stichting Deltares 2018. All rights reserved.
+// Copyright (C) Stichting Deltares 2018. All rights reserved.
//
// This file is part of Ringtoets.
//
@@ -114,6 +114,7 @@
using RingtoetsCommonServiceResources = Ringtoets.Common.Service.Properties.Resources;
using BaseResources = Core.Common.Base.Properties.Resources;
using GuiResources = Core.Common.Gui.Properties.Resources;
+using HydraulicBoundaryDatabaseImporter = Ringtoets.Integration.IO.Importers.HydraulicBoundaryDatabaseImporter;
namespace Ringtoets.Integration.Plugin
{
@@ -764,6 +765,20 @@
IsEnabled = context => HasGeometry(context.ParentAssessmentSection.ReferenceLine),
VerifyUpdates = context => VerifyForeshoreProfileUpdates(context, Resources.RingtoetsPlugin_VerifyForeshoreProfileUpdates_When_importing_ForeshoreProfile_definitions_assigned_to_calculations_output_will_be_cleared_confirm)
};
+
+ yield return new ImportInfo
+ {
+ Name = RingtoetsCommonDataResources.HydraulicBoundaryConditions_DisplayName,
+ Image = RingtoetsCommonFormsResources.DatabaseIcon,
+ Category = RingtoetsCommonFormsResources.Ringtoets_Category,
+ FileFilterGenerator = new FileFilterGenerator(Resources.HydraulicBoundaryDatabase_FilePath_Extension,
+ RingtoetsFormsResources.HydraulicBoundaryDatabase_FilePath_DisplayName),
+ CreateFileImporter = (context, filePath) => new HydraulicBoundaryDatabaseImporter(
+ context.WrappedData, new HydraulicBoundaryDatabaseUpdateHandler(
+ context.AssessmentSection, new DuneLocationsReplacementHandler(
+ Gui.ViewCommands, context.AssessmentSection.DuneErosion)),
+ filePath)
+ };
}
public override IEnumerable GetExportInfos()
@@ -2333,7 +2348,7 @@
return;
}
- using (var hydraulicBoundaryLocationsImporter = new HydraulicBoundaryDatabaseImporter())
+ using (var hydraulicBoundaryLocationsImporter = new Common.IO.FileImporters.HydraulicBoundaryDatabaseImporter())
{
if (!hydraulicBoundaryLocationsImporter.Import(assessmentSection, databaseFile))
{
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ImportInfos/HydraulicBoundaryDatabaseContextImportInfoTest.cs
===================================================================
diff -u
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ImportInfos/HydraulicBoundaryDatabaseContextImportInfoTest.cs (revision 0)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ImportInfos/HydraulicBoundaryDatabaseContextImportInfoTest.cs (revision 0a1800fa11da26bf8304e59cb3a46bd6b0a0af60)
@@ -0,0 +1,133 @@
+// Copyright (C) Stichting Deltares 2018. 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.Drawing;
+using System.Linq;
+using Core.Common.Base.IO;
+using Core.Common.Gui;
+using Core.Common.Gui.Commands;
+using Core.Common.Gui.Plugin;
+using Core.Common.TestUtil;
+using Core.Common.Util;
+using NUnit.Framework;
+using Rhino.Mocks;
+using Ringtoets.Common.Data.AssessmentSection;
+using Ringtoets.Common.Data.Hydraulics;
+using Ringtoets.Integration.Data;
+using Ringtoets.Integration.Forms.PresentationObjects;
+using Ringtoets.Integration.IO.Importers;
+using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources;
+
+namespace Ringtoets.Integration.Plugin.Test.ImportInfos
+{
+ [TestFixture]
+ public class HydraulicBoundaryDatabaseContextImportInfoTest
+ {
+ private MockRepository mocks;
+ private ImportInfo importInfo;
+ private RingtoetsPlugin plugin;
+
+ [SetUp]
+ public void SetUp()
+ {
+ mocks = new MockRepository();
+ var gui = mocks.Stub();
+ gui.Stub(g => g.ViewCommands).Return(mocks.Stub());
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+ mocks.ReplayAll();
+
+ plugin = new RingtoetsPlugin
+ {
+ Gui = gui
+ };
+ importInfo = plugin.GetImportInfos().First(i => i.DataType == typeof(HydraulicBoundaryDatabaseContext));
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ plugin.Dispose();
+ mocks.VerifyAll();
+ }
+
+ [Test]
+ public void Name_Always_ReturnExpectedName()
+ {
+ // Call
+ string name = importInfo.Name;
+
+ // Assert
+ Assert.AreEqual("Hydraulische belastingen", name);
+ }
+
+ [Test]
+ public void Category_Always_ReturnExpectedCategory()
+ {
+ // Call
+ string category = importInfo.Category;
+
+ // Assert
+ Assert.AreEqual("Algemeen", category);
+ }
+
+ [Test]
+ public void Image_Always_ReturnExpectedIcon()
+ {
+ // Call
+ Image image = importInfo.Image;
+
+ // Assert
+ TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.DatabaseIcon, image);
+ }
+
+ [Test]
+ public void FileFilterGenerator_Always_ReturnExpectedFileFilter()
+ {
+ // Call
+ FileFilterGenerator fileFilterGenerator = importInfo.FileFilterGenerator;
+
+ // Assert
+ Assert.AreEqual("Hydraulische belastingendatabase (*.sqlite)|*.sqlite", fileFilterGenerator.Filter);
+ }
+
+ [Test]
+ public void CreateFileImporter_Always_ReturnFileImporter()
+ {
+ // Setup
+ mocks = new MockRepository();
+ var gui = mocks.Stub();
+ gui.Stub(g => g.ViewCommands).Return(mocks.Stub());
+ gui.Stub(g => g.ProjectOpened += null).IgnoreArguments();
+ gui.Stub(g => g.ProjectOpened -= null).IgnoreArguments();
+ mocks.ReplayAll();
+
+ var importTarget = new HydraulicBoundaryDatabaseContext(new HydraulicBoundaryDatabase(), new AssessmentSection(AssessmentSectionComposition.Dike));
+
+ // Call
+ IFileImporter importer = importInfo.CreateFileImporter(importTarget, "");
+
+ // Assert
+ Assert.IsInstanceOf(importer);
+ mocks.VerifyAll();
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj
===================================================================
diff -u -r888f36137652f1d7bef55426200146c9df7d0bdf -r0a1800fa11da26bf8304e59cb3a46bd6b0a0af60
--- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 888f36137652f1d7bef55426200146c9df7d0bdf)
+++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 0a1800fa11da26bf8304e59cb3a46bd6b0a0af60)
@@ -58,6 +58,7 @@
+