Index: Core/Common/test/Core.Common.TestUtil/TestDataPath.cs =================================================================== diff -u -r58e275211395fc690df2706ccdaff082ecf7b544 -r722099fa17acd4e499bd1f83daa63a6af2bb688a --- Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision 58e275211395fc690df2706ccdaff082ecf7b544) +++ Core/Common/test/Core.Common.TestUtil/TestDataPath.cs (.../TestDataPath.cs) (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -69,6 +69,12 @@ public static readonly TestDataPath IO = System.IO.Path.Combine("Ringtoets", "Common", "test", "Ringtoets.Common.IO.Test"); } + public static class GrassCoverErosionInwards + { + public static readonly TestDataPath IO = System.IO.Path.Combine("Ringtoets", "GrassCoverErosionInwards", "test", "Ringtoets.GrassCoverErosionInwards.IO.Test"); + public static readonly TestDataPath Integration = System.IO.Path.Combine("Ringtoets", "GrassCoverErosionInwards", "test", "Ringtoets.GrassCoverErosionInwards.Integration.Test"); + } + public static class HydraRing { public static readonly TestDataPath IO = System.IO.Path.Combine("Ringtoets", "HydraRing", "test", "Ringtoets.HydraRing.IO.Test"); @@ -79,14 +85,9 @@ { public static readonly TestDataPath Forms = System.IO.Path.Combine("Ringtoets", "Integration", "test", "Ringtoets.Integration.Forms.Test"); public static readonly TestDataPath Service = System.IO.Path.Combine("Ringtoets", "Integration", "test", "Ringtoets.Integration.Service.Test"); + public static readonly TestDataPath Plugin = System.IO.Path.Combine("Ringtoets", "Integration", "test", "Ringtoets.Integration.Plugin.Test"); } - public static class GrassCoverErosionInwards - { - public static readonly TestDataPath IO = System.IO.Path.Combine("Ringtoets", "GrassCoverErosionInwards", "test", "Ringtoets.GrassCoverErosionInwards.IO.Test"); - public static readonly TestDataPath Integration = System.IO.Path.Combine("Ringtoets", "GrassCoverErosionInwards", "test", "Ringtoets.GrassCoverErosionInwards.Integration.Test"); - } - public static class Piping { public static readonly TestDataPath IO = System.IO.Path.Combine("Ringtoets", "Piping", "test", "Ringtoets.Piping.IO.Test"); Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryDatabaseImporter.cs =================================================================== diff -u -rfef3460a27a37aaa34948649aae3dd9ae143041c -r722099fa17acd4e499bd1f83daa63a6af2bb688a --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryDatabaseImporter.cs (.../HydraulicBoundaryDatabaseImporter.cs) (revision fef3460a27a37aaa34948649aae3dd9ae143041c) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryDatabaseImporter.cs (.../HydraulicBoundaryDatabaseImporter.cs) (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -151,6 +151,8 @@ // Locations directory of HLCD location ids and HRD location ids var locationidsDictionary = hydraulicLocationConfigurationDatabaseReader.GetLocationsIdByTrackId(trackId); + var filter = new HydraulicBoundaryLocationFilter(); + // Prepare query to fetch hrd locations hydraulicBoundaryDatabaseReader.PrepareReadLocation(); while (hydraulicBoundaryDatabaseReader.HasNext) @@ -160,12 +162,15 @@ long locationId; locationidsDictionary.TryGetValue(hrdLocation.HrdLocationId, out locationId); - var hydraulicBoundaryLocation = new HydraulicBoundaryLocation( - locationId, - hrdLocation.Name, - hrdLocation.LocationX, - hrdLocation.LocationY); - hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + if (filter.ShouldInclude(locationId)) + { + var hydraulicBoundaryLocation = new HydraulicBoundaryLocation( + locationId, + hrdLocation.Name, + hrdLocation.LocationX, + hrdLocation.LocationY); + hydraulicBoundaryDatabase.Locations.Add(hydraulicBoundaryLocation); + } } return hydraulicBoundaryDatabase; } Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryLocationFilter.cs =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryLocationFilter.cs (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/FileImporters/HydraulicBoundaryLocationFilter.cs (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -0,0 +1,63 @@ +// 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.Collections.Generic; +using System.Linq; +using Ringtoets.HydraRing.Data; +using Ringtoets.Integration.Plugin.Properties; + +namespace Ringtoets.Integration.Plugin.FileImporters +{ + /// + /// This class allows for filtering out based + /// on their name. + /// + public class HydraulicBoundaryLocationFilter + { + private readonly List locationsToFilterOut; + + public HydraulicBoundaryLocationFilter() + { + string[] idsAsText = Resources.HydraulicBoundaryLocationsFilterList.Split(new[] + { + Environment.NewLine, + "\n" + }, StringSplitOptions.RemoveEmptyEntries); + var filterList = new List(idsAsText.Skip(1).Select(long.Parse)); // Skip the header, parse the remainder + filterList.Sort(); + + locationsToFilterOut = filterList; + } + + /// + /// Indicates if the with + /// should be imported. + /// + /// The name of the location. + /// True if the location should be imported, false otherwise. + public bool ShouldInclude(long locationId) + { + int matchingIndex = locationsToFilterOut.BinarySearch(locationId); + return matchingIndex < 0; + } + } +} \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs =================================================================== diff -u -rd1c832128168938c7cb5ed4b1ac54382e0fc96fe -r722099fa17acd4e499bd1f83daa63a6af2bb688a --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision d1c832128168938c7cb5ed4b1ac54382e0fc96fe) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -1,28 +1,7 @@ -// 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. - -//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17929 +// Runtime Version:4.0.30319.18444 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -203,6 +182,87 @@ } /// + /// Looks up a localized string similar to LocationID + ///303193 + ///303195 + ///303325 + ///303494 + ///303511 + ///303542 + ///304012 + ///304114 + ///304130 + ///304133 + ///304137 + ///304138 + ///304139 + ///304140 + ///304142 + ///304177 + ///304214 + ///304220 + ///304251 + ///304264 + ///304271 + ///304339 + ///304341 + ///304401 + ///304408 + ///304411 + ///304454 + ///304458 + ///304459 + ///304466 + ///304473 + ///304604 + ///305116 + ///305161 + ///305162 + ///305164 + ///305220 + ///305229 + ///305258 + ///305260 + ///305261 + ///305290 + ///305342 + ///305377 + ///305392 + ///305414 + ///305416 + ///305421 + ///305452 + ///305456 + ///305478 + ///305497 + ///305505 + ///305533 + ///305617 + ///305633 + ///305653 + ///305654 + ///305655 + ///305656 + ///305659 + ///305660 + ///305669 + ///305672 + ///305674 + ///305675 + ///305676 + ///305677 + ///305678 + ///305680 + ///305682 + ///3056 [rest of string was truncated]";. + /// + public static string HydraulicBoundaryLocationsFilterList { + get { + return ResourceManager.GetString("HydraulicBoundaryLocationsFilterList", resourceCulture); + } + } + + /// /// Looks up a localized string similar to Berekeningen konden niet worden gestart. {0}. /// public static string RingtoetsPlugin_HydraulicBoundaryDatabaseContextMenuStrip_Start_calculation_failed_0_ { Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx =================================================================== diff -u -rd1c832128168938c7cb5ed4b1ac54382e0fc96fe -r722099fa17acd4e499bd1f83daa63a6af2bb688a --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision d1c832128168938c7cb5ed4b1ac54382e0fc96fe) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -163,4 +163,8 @@ {0} Er zijn geen hydraulische randvoorwaarden locaties geëxporteerd. + + + ..\Resources\Exceptions_DoNotCalculate.csv;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Resources/Exceptions_DoNotCalculate.csv =================================================================== diff -u --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Resources/Exceptions_DoNotCalculate.csv (revision 0) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Resources/Exceptions_DoNotCalculate.csv (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -0,0 +1,341 @@ +LocationID +303193 +303195 +303325 +303494 +303511 +303542 +304012 +304114 +304130 +304133 +304137 +304138 +304139 +304140 +304142 +304177 +304214 +304220 +304251 +304264 +304271 +304339 +304341 +304401 +304408 +304411 +304454 +304458 +304459 +304466 +304473 +304604 +305116 +305161 +305162 +305164 +305220 +305229 +305258 +305260 +305261 +305290 +305342 +305377 +305392 +305414 +305416 +305421 +305452 +305456 +305478 +305497 +305505 +305533 +305617 +305633 +305653 +305654 +305655 +305656 +305659 +305660 +305669 +305672 +305674 +305675 +305676 +305677 +305678 +305680 +305682 +305683 +305686 +305687 +305688 +305689 +305690 +305691 +305692 +305694 +305699 +305700 +305716 +305724 +305725 +305758 +305760 +305950 +305984 +305991 +305992 +305993 +305994 +305995 +305997 +306000 +306002 +306006 +306007 +306009 +306010 +306111 +306117 +306118 +306186 +306351 +306408 +306419 +306490 +306550 +307416 +307419 +307442 +307448 +307450 +307451 +307452 +307453 +307531 +307620 +307628 +307642 +307823 +307830 +307831 +307849 +307887 +307890 +308000 +308007 +308008 +308009 +308010 +308011 +308014 +308041 +308120 +308123 +308124 +308127 +308128 +308129 +308130 +308134 +308135 +308138 +308139 +308140 +308142 +308152 +308154 +308155 +308157 +308158 +308159 +308182 +308196 +308555 +308556 +308557 +308558 +308567 +308578 +308582 +308589 +308600 +308602 +308603 +308604 +308605 +308606 +308608 +308611 +308612 +308614 +308615 +308618 +308628 +308630 +308632 +308639 +308640 +308651 +308652 +308653 +308655 +308657 +308658 +308662 +308665 +308666 +308667 +308668 +308669 +308670 +308671 +308672 +308673 +308674 +308675 +308676 +308677 +308679 +308680 +308681 +308682 +308683 +308684 +308685 +308686 +308689 +308690 +308694 +308697 +308698 +308699 +308700 +308710 +308711 +308712 +308715 +308722 +308723 +308724 +308725 +309114 +309163 +309170 +309172 +309175 +309182 +309183 +309217 +309269 +309270 +309271 +309278 +309279 +309280 +309281 +309282 +309283 +309284 +309285 +309286 +309287 +309288 +309289 +309290 +309291 +309292 +309293 +309295 +309382 +309383 +309404 +309405 +309406 +309408 +309410 +309411 +309412 +309414 +309467 +309468 +309470 +309471 +310003 +310004 +310016 +310017 +310019 +310020 +310021 +310022 +310023 +310024 +310034 +310035 +310036 +310037 +310040 +310160 +310565 +310594 +310595 +310617 +310618 +310619 +310622 +310634 +403188 +403285 +403296 +403307 +403318 +403352 +403355 +403356 +403434 +403435 +403663 +403665 +403666 +406878 +406955 +406956 +406957 +406959 +407123 +407124 +407145 +407197 +500759 +500782 +501311 +501350 +501351 +501772 +501774 +501775 +501776 +501777 +501779 +602100 +602152 +602518 +602521 +602523 +602544 +602589 +602595 +602601 +602688 +602705 +602908 +602953 +602954 +603070 +603075 \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj =================================================================== diff -u -r9312943e6ef9894811d9b0b87239af47f79205ec -r722099fa17acd4e499bd1f83daa63a6af2bb688a --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 9312943e6ef9894811d9b0b87239af47f79205ec) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/Ringtoets.Integration.Plugin.csproj (.../Ringtoets.Integration.Plugin.csproj) (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -57,6 +57,7 @@ + True @@ -186,6 +187,7 @@ Copying.licenseheader + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs =================================================================== diff -u -rce31448a066c084f755439f3e7d453bfb042b291 -r722099fa17acd4e499bd1f83daa63a6af2bb688a --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision ce31448a066c084f755439f3e7d453bfb042b291) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryDatabaseImporterTest.cs (.../HydraulicBoundaryDatabaseImporterTest.cs) (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -187,7 +187,8 @@ assessmentSection.Expect(section => section.NotifyObservers()); mocks.ReplayAll(); - string validFilePath = Path.Combine(testDataPath, "complete.sqlite"); + string validFilePath = TestHelper.GetTestDataPath(TestDataPath.Ringtoets.Integration.Plugin, + "completeWithLocationsToBeFilteredOut.sqlite"); // Precondition Assert.IsTrue(File.Exists(validFilePath), string.Format("Precodition failed. File does not exist: {0}", validFilePath)); @@ -204,7 +205,7 @@ }); Assert.IsTrue(importResult); ICollection importedLocations = assessmentSection.HydraulicBoundaryDatabase.Locations; - Assert.AreEqual(18, importedLocations.Count); + Assert.AreEqual(9, importedLocations.Count); CollectionAssert.AllItemsAreNotNull(importedLocations); CollectionAssert.AllItemsAreUnique(importedLocations); mocks.VerifyAll(); Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryLocationFilterTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryLocationFilterTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/FileImporters/HydraulicBoundaryLocationFilterTest.cs (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -0,0 +1,45 @@ +using System; +using NUnit.Framework; +using Ringtoets.Integration.Plugin.FileImporters; + +namespace Ringtoets.Integration.Plugin.Test.FileImporters +{ + [TestFixture] + public class HydraulicBoundaryLocationFilterTest + { + [Test] + [TestCase(-1)] + [TestCase(long.MinValue)] + [TestCase(303192)] + [TestCase(303194)] + [TestCase(603074)] + [TestCase(603076)] + [TestCase(long.MaxValue)] + public void ShouldInclude_NameNotInFilterSet_ReturnsTrue(long id) + { + // Setup + var filter = new HydraulicBoundaryLocationFilter(); + + // Call + bool shouldBeIncluded = filter.ShouldInclude(id); + + // Assert + Assert.IsTrue(shouldBeIncluded); + } + + [Test] + [TestCase(303193)] + [TestCase(603075)] + public void ShouldInclude_NameInFilterSet_ReturnsFalse(long id) + { + // Setup + var filter = new HydraulicBoundaryLocationFilter(); + + // Call + bool shouldBeIncluded = filter.ShouldInclude(id); + + // Assert + Assert.IsFalse(shouldBeIncluded); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -r9312943e6ef9894811d9b0b87239af47f79205ec -r722099fa17acd4e499bd1f83daa63a6af2bb688a --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 9312943e6ef9894811d9b0b87239af47f79205ec) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision 722099fa17acd4e499bd1f83daa63a6af2bb688a) @@ -71,6 +71,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/test-data/HLCD.sqlite =================================================================== diff -u Binary files differ Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/test-data/completeWithLocationsToBeFilteredOut.sqlite =================================================================== diff -u Binary files differ