Index: Core/Common/src/Core.Common.IO/Core.Common.IO.csproj
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Core/Common/src/Core.Common.IO/Core.Common.IO.csproj (.../Core.Common.IO.csproj) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Core/Common/src/Core.Common.IO/Core.Common.IO.csproj (.../Core.Common.IO.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -46,6 +46,7 @@
+
Index: Core/Common/src/Core.Common.IO/Exceptions/LineParseException.cs
===================================================================
diff -u
--- Core/Common/src/Core.Common.IO/Exceptions/LineParseException.cs (revision 0)
+++ Core/Common/src/Core.Common.IO/Exceptions/LineParseException.cs (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -0,0 +1,54 @@
+// 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;
+
+namespace Core.Common.IO.Exceptions
+{
+ ///
+ /// The exception that is thrown when a file reader class encounters an error while
+ /// parsing a row/line during the read.
+ ///
+ public class LineParseException : Exception
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public LineParseException() {}
+
+ ///
+ /// Initializes a new instance of the class
+ /// with a specified error message.
+ ///
+ /// The error message that explains the reason for the exception.
+ public LineParseException(string message) : base(message) {}
+
+ ///
+ /// Initializes a new instance of the class
+ /// with a specified error message and a reference to the inner exception that is
+ /// the cause of this exception.
+ ///
+ /// The error message that explains the reason for the exception.
+ /// The exception that is the cause of the current exception,
+ /// or a null reference if no inner exception is specified.
+ public LineParseException(string message, Exception inner) : base(message, inner) {}
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.IO.Test/Core.Common.IO.Test.csproj
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Core/Common/test/Core.Common.IO.Test/Core.Common.IO.Test.csproj (.../Core.Common.IO.Test.csproj) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Core/Common/test/Core.Common.IO.Test/Core.Common.IO.Test.csproj (.../Core.Common.IO.Test.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -49,6 +49,7 @@
+
Index: Core/Common/test/Core.Common.IO.Test/Exceptions/LineParseExceptionTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.IO.Test/Exceptions/LineParseExceptionTest.cs (revision 0)
+++ Core/Common/test/Core.Common.IO.Test/Exceptions/LineParseExceptionTest.cs (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -0,0 +1,70 @@
+using System;
+using Core.Common.IO.Exceptions;
+using NUnit.Framework;
+
+namespace Core.Common.IO.Test.Exceptions
+{
+ [TestFixture]
+ public class LineParseExceptionTest
+ {
+ [Test]
+ [SetCulture("en-US")]
+ public void DefaultConstructor_ExpectedValues()
+ {
+ // Call
+ var exception = new LineParseException();
+
+ // Assert
+ Assert.IsInstanceOf(exception);
+ var expectedMessage = string.Format("Exception of type '{0}' was thrown.", exception.GetType());
+ Assert.AreEqual(expectedMessage, exception.Message);
+ CollectionAssert.IsEmpty(exception.Data);
+ Assert.IsNull(exception.HelpLink);
+ Assert.IsNull(exception.InnerException);
+ Assert.IsNull(exception.Source);
+ Assert.IsNull(exception.StackTrace);
+ Assert.IsNull(exception.TargetSite);
+ }
+
+ [Test]
+ public void MessageConstructor_ExpectedValues()
+ {
+ // Setup
+ const string messageText = "";
+
+ // Call
+ var exception = new LineParseException(messageText);
+
+ // Assert
+ Assert.IsInstanceOf(exception);
+ Assert.AreEqual(messageText, exception.Message);
+ CollectionAssert.IsEmpty(exception.Data);
+ Assert.IsNull(exception.HelpLink);
+ Assert.IsNull(exception.InnerException);
+ Assert.IsNull(exception.Source);
+ Assert.IsNull(exception.StackTrace);
+ Assert.IsNull(exception.TargetSite);
+ }
+
+ [Test]
+ public void MessageAndInnerExceptionConstructor_ExpectedValues()
+ {
+ // Setup
+ var innerException = new Exception();
+ const string messageText = "";
+
+ // Call
+ var exception = new LineParseException(messageText, innerException);
+
+ // Assert
+ Assert.IsInstanceOf(exception);
+ Assert.AreEqual(messageText, exception.Message);
+ CollectionAssert.IsEmpty(exception.Data);
+ Assert.IsNull(exception.HelpLink);
+ Assert.AreEqual(innerException, exception.InnerException);
+ Assert.IsNull(exception.Source);
+ Assert.IsNull(exception.StackTrace);
+ Assert.IsNull(exception.TargetSite);
+ }
+ }
+}
\ No newline at end of file
Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs
===================================================================
diff -u -rad2d65c5904706727b1e19341a8b1162645c845a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision ad2d65c5904706727b1e19341a8b1162645c845a)
+++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoDikeAssessmentSectionCommand.cs (.../AddNewDemoDikeAssessmentSectionCommand.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -76,8 +76,8 @@
{
hydraulicBoundaryDatabase.FilePath = tempPath.FilePath;
var hydraulicBoundaryDatabaseImporter = new HydraulicBoundaryLocationsImporter();
- hydraulicBoundaryDatabaseImporter.ValidateFile(tempPath.FilePath);
- hydraulicBoundaryDatabase.Version = hydraulicBoundaryDatabaseImporter.Version;
+ hydraulicBoundaryDatabase.Version =
+ hydraulicBoundaryDatabaseImporter.GetHydraulicBoundaryDatabaseVersion(tempPath.FilePath);
hydraulicBoundaryDatabaseImporter.Import(hydraulicBoundaryDatabase.Locations, tempPath.FilePath);
}
}
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/HydraulicBoundaryLocation.cs
===================================================================
diff -u -rc26eae7ea2f20bfbe3136208b302f83a4003c26c -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/HydraulicBoundaryLocation.cs (.../HydraulicBoundaryLocation.cs) (revision c26eae7ea2f20bfbe3136208b302f83a4003c26c)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Data/HydraulicBoundaryLocation.cs (.../HydraulicBoundaryLocation.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -34,13 +34,13 @@
///
/// Id of the .
/// Name of the .
- /// X-coordinate of the .
- /// Y-coordinate of the .
- public HydraulicBoundaryLocation(long id, string name, double x, double y)
+ /// X coordinate of the .
+ /// Y coordinate of the .
+ public HydraulicBoundaryLocation(long id, string name, double coordinateX, double coordinateY)
{
Id = id;
Name = name;
- Location = new Point2D(x, y);
+ Location = new Point2D(coordinateX, coordinateY);
DesignWaterLevel = Double.NaN;
}
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/Properties/Resources.Designer.cs
===================================================================
diff -u -r65bf14c434dfcc0e86d229c933118492d9eec438 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 65bf14c434dfcc0e86d229c933118492d9eec438)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -283,18 +283,18 @@
///
/// Looks up a localized string similar to Hydraulische randvoorwaarden database.
///
- public static string SelectDatabaseFile_FilterName {
+ public static string SelectHydraulicBoundaryDatabaseFile_FilterName {
get {
- return ResourceManager.GetString("SelectDatabaseFile_FilterName", resourceCulture);
+ return ResourceManager.GetString("SelectHydraulicBoundaryDatabaseFile_FilterName", resourceCulture);
}
}
///
/// Looks up a localized string similar to Selecteer database.
///
- public static string SelectDatabaseFile_Title {
+ public static string SelectHydraulicBoundaryDatabaseFile_Title {
get {
- return ResourceManager.GetString("SelectDatabaseFile_Title", resourceCulture);
+ return ResourceManager.GetString("SelectHydraulicBoundaryDatabaseFile_Title", resourceCulture);
}
}
}
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/Properties/Resources.resx
===================================================================
diff -u -r65bf14c434dfcc0e86d229c933118492d9eec438 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/Properties/Resources.resx (.../Resources.resx) (revision 65bf14c434dfcc0e86d229c933118492d9eec438)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Forms/Properties/Resources.resx (.../Resources.resx) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -158,10 +158,10 @@
Database op pad {0} gekoppeld
-
+
Hydraulische randvoorwaarden database
-
+
Selecteer database
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/GeneralEntity.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/GeneralEntity.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/GeneralEntity.cs (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -0,0 +1,9 @@
+namespace Ringtoets.HydraRing.IO.HydraulicBoundaryDatabase
+{
+ internal class GeneralEntity
+ {
+ internal const string TableName = "General";
+ internal const string NameRegion = "NameRegion";
+ internal const string CreationDate = "CreationDate";
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsEntity.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsEntity.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HrdLocationsEntity.cs (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -0,0 +1,12 @@
+namespace Ringtoets.HydraRing.IO.HydraulicBoundaryDatabase
+{
+ public static class HrdLocationsEntity
+ {
+ internal const string TableName = "HRDLocations";
+ internal const string HrdLocationId = "HRDLocationId";
+ internal const string LocationTypeId = "LocationTypeId";
+ internal const string Name = "Name";
+ internal const string XCoordinate = "XCoordinate";
+ internal const string YCoordinate = "YCoordinate";
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs
===================================================================
diff -u
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs (revision 0)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabase/HydraulicBoundaryDatabaseQueryBuilder.cs (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -0,0 +1,43 @@
+namespace Ringtoets.HydraRing.IO.HydraulicBoundaryDatabase
+{
+ public static class HydraulicBoundaryDatabaseQueryBuilder
+ {
+ public static string GetVersionQuery()
+ {
+ return string.Format(
+ "SELECT ({0} || {1}) as {2} FROM {3} LIMIT 0,1;",
+ GeneralEntity.NameRegion,
+ GeneralEntity.CreationDate,
+ HydraulicBoundaryDatabaseColumns.Version,
+ GeneralEntity.TableName
+ );
+ }
+
+ public static string GetLocationsCountQuery()
+ {
+ return string.Format(
+ "SELECT count({0}) as {1} FROM {2} WHERE {3} > 1 ;",
+ HrdLocationsEntity.HrdLocationId,
+ HydraulicBoundaryDatabaseColumns.LocationCount,
+ HrdLocationsEntity.TableName,
+ HrdLocationsEntity.LocationTypeId
+ );
+ }
+
+ public static string GetLocationsQuery()
+ {
+ return string.Format(
+ "SELECT {0} as {1}, " +
+ "{2} as {3}, " +
+ "{4} as {5}, " +
+ "{6} as {7} FROM " +
+ "{8} WHERE {9} > 1;",
+ HrdLocationsEntity.HrdLocationId, HydraulicBoundaryDatabaseColumns.LocationId,
+ HrdLocationsEntity.Name, HydraulicBoundaryDatabaseColumns.LocationName,
+ HrdLocationsEntity.XCoordinate, HydraulicBoundaryDatabaseColumns.LocationX,
+ HrdLocationsEntity.YCoordinate, HydraulicBoundaryDatabaseColumns.LocationY,
+ HrdLocationsEntity.TableName,
+ HrdLocationsEntity.LocationTypeId);
+ }
+ }
+}
\ No newline at end of file
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseColumns.cs
===================================================================
diff -u -r26346cdbee096c58b9a2ca5fb3dad932f5827f3a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseColumns.cs (.../HydraulicBoundaryDatabaseColumns.cs) (revision 26346cdbee096c58b9a2ca5fb3dad932f5827f3a)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundaryDatabaseColumns.cs (.../HydraulicBoundaryDatabaseColumns.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -22,7 +22,7 @@
namespace Ringtoets.HydraRing.IO
{
///
- /// Represents columns that are set in the queries to the hydraulic boundary database.
+ /// Defines columns that are set in the queries to the hydraulic boundary database.
///
internal static class HydraulicBoundaryDatabaseColumns
{
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs
===================================================================
diff -u -r7235aeaea6e256141b54459aa33da203e84f280b -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs (.../HydraulicBoundarySqLiteDatabaseReader.cs) (revision 7235aeaea6e256141b54459aa33da203e84f280b)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/HydraulicBoundarySqLiteDatabaseReader.cs (.../HydraulicBoundarySqLiteDatabaseReader.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -26,31 +26,33 @@
using Core.Common.IO.Readers;
using Core.Common.Utils.Builders;
using Ringtoets.HydraRing.Data;
+using Ringtoets.HydraRing.IO.HydraulicBoundaryDatabase;
using Ringtoets.HydraRing.IO.Properties;
namespace Ringtoets.HydraRing.IO
{
///
- /// This class reads a SqLite database file and constructs instances from this database.
+ /// This class reads a SqLite database file and constructs
+ /// instances from this database.
///
- public class HydraulicBoundarySqLiteDatabaseReader : SqLiteDatabaseReaderBase, IRowBasedDatabaseReader
+ public class HydraulicBoundarySqLiteDatabaseReader : SqLiteDatabaseReaderBase
{
private SQLiteDataReader dataReader;
///
- /// Creates a new instance of , which will use the
+ /// Creates a new instance of , which will use
+ /// the
/// as its source.
///
/// The path of the database file to open.
/// Thrown when:
///
/// - The contains invalid characters.
/// - No file could be found at .
- /// - Preparing the queries to read from the database failed.
+ /// - Preparing the database queries failed.
///
///
- public HydraulicBoundarySqLiteDatabaseReader(string databaseFilePath)
- : base(databaseFilePath)
+ public HydraulicBoundarySqLiteDatabaseReader(string databaseFilePath) : base(databaseFilePath)
{
InitializeReader();
}
@@ -74,8 +76,10 @@
///
/// Reads the next location from the database.
///
- /// New instance of , based on the data read from the database or null if no data is available.
- /// Thrown when the database returned incorrect values for required properties.
+ /// New instance of , based on the data read from the
+ /// database or null if no data is available.
+ /// Thrown when the database returned incorrect values for
+ /// required properties.
public HydraulicBoundaryLocation ReadLocation()
{
if (!HasNext)
@@ -89,14 +93,12 @@
}
catch (InvalidCastException e)
{
- var message = new FileReaderErrorMessageBuilder(Path).Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
- throw new CriticalFileReadException(message, e);
+ var message = new FileReaderErrorMessageBuilder(Path).
+ Build(Resources.HydraulicBoundaryDatabaseReader_Critical_Unexpected_value_on_column);
+ throw new LineParseException(message, e);
}
}
- ///
- /// Disposes the reader.
- ///
public override void Dispose()
{
if (dataReader != null)
@@ -109,7 +111,7 @@
///
/// Moves the reader to the next record in the database.
///
- public void MoveNext()
+ private void MoveNext()
{
HasNext = dataReader.Read() || (dataReader.NextResult() && dataReader.Read());
}
@@ -120,34 +122,19 @@
/// The expected type of value in the column with name .
/// The name of the column to read from.
/// The read value from the column with name .
- /// Thrown when the value in the column was not of type .
- public T Read(string columnName)
+ /// Thrown when the value in the column was not of type
+ /// .
+ private T Read(string columnName)
{
return (T) dataReader[columnName];
}
///
- /// Reads the value in the column with name from the currently pointed row.
- ///
- /// The type of object to read.
- /// The name of the column to read from.
- /// The value in the column, or null if the value was .
- /// Thrown when the value in the column could not be casted to type .
- public T? ReadOrNull(string columnName) where T : struct
- {
- var valueObject = dataReader[columnName];
- if (valueObject.Equals(DBNull.Value))
- {
- return null;
- }
- return (T) valueObject;
- }
-
- ///
/// Reads the current row into a new instance of .
///
/// A new instance of , based upon the current row.
- /// Thrown when the database returned incorrect values for required properties.
+ /// Thrown when the database returned incorrect values for
+ /// required properties.
private HydraulicBoundaryLocation ReadHydraulicBoundaryLocation()
{
try
@@ -159,7 +146,7 @@
MoveNext();
return new HydraulicBoundaryLocation(id, name, x, y);
}
- catch (InvalidCastException exception)
+ catch (InvalidCastException)
{
MoveNext();
throw;
@@ -181,16 +168,10 @@
///
private void PrepareReader()
{
- var versionQuery = string.Format("SELECT (NameRegion || CreationDate) as {0} FROM General LIMIT 0,1;", HydraulicBoundaryDatabaseColumns.Version);
- var countQuery = string.Format("SELECT count(*) as {0} FROM HRDLocations WHERE LocationTypeId > 1 ;", HydraulicBoundaryDatabaseColumns.LocationCount);
+ var versionQuery = HydraulicBoundaryDatabaseQueryBuilder.GetVersionQuery();
+ var countQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsCountQuery();
+ var locationsQuery = HydraulicBoundaryDatabaseQueryBuilder.GetLocationsQuery();
- var locationsQuery = string.Format(
- "SELECT HRDLocationId as {0}, Name as {1}, XCoordinate as {2}, YCoordinate as {3} FROM HRDLocations WHERE LocationTypeId > 1;",
- HydraulicBoundaryDatabaseColumns.LocationId,
- HydraulicBoundaryDatabaseColumns.LocationName,
- HydraulicBoundaryDatabaseColumns.LocationX,
- HydraulicBoundaryDatabaseColumns.LocationY);
-
CreateDataReader(string.Join(" ", versionQuery, countQuery, locationsQuery), new SQLiteParameter
{
DbType = DbType.String
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.IO/Ringtoets.HydraRing.IO.csproj (.../Ringtoets.HydraRing.IO.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -47,8 +47,11 @@
Properties\GlobalAssembly.cs
+
+
+
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryLocationsImporter.cs
===================================================================
diff -u -r925d8a1d7dec6ef95d89b2ff67d78c8d5a49387f -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryLocationsImporter.cs (.../HydraulicBoundaryLocationsImporter.cs) (revision 925d8a1d7dec6ef95d89b2ff67d78c8d5a49387f)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/HydraulicBoundaryLocationsImporter.cs (.../HydraulicBoundaryLocationsImporter.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -34,24 +34,16 @@
using ApplicationResources = Ringtoets.HydraRing.Plugin.Properties.Resources;
using HydraRingResources = Ringtoets.HydraRing.Forms.Properties.Resources;
-
namespace Ringtoets.HydraRing.Plugin
{
///
- /// Imports Hydraulic boundary .sqlite files (SqlLite database files).
+ /// Imports locations read from an Hydraulic boundary .sqlite file (SqlLite database file) to a
+ /// collection of .
///
public class HydraulicBoundaryLocationsImporter : FileImporterBase
{
private readonly ILog log = LogManager.GetLogger(typeof(HydraulicBoundaryLocationsImporter));
- ///
- /// Gets the version of the used Hydraulic Boundary Database.
- ///
- public string Version { get; private set; }
-
- ///
- /// Gets the name of the .
- ///
public override string Name
{
get
@@ -60,9 +52,6 @@
}
}
- ///
- /// Gets the category of the .
- ///
public override string Category
{
get
@@ -71,10 +60,6 @@
}
}
- ///
- /// Gets the image of the .
- ///
- /// This image can be used in selection and/or progress dialogs.
public override Bitmap Image
{
get
@@ -83,76 +68,51 @@
}
}
- ///
- /// Gets the of the item supported by the .
- ///
public override Type SupportedItemType
{
get
{
- return typeof(HydraulicBoundaryLocation);
+ return typeof(ICollection);
}
}
- ///
- /// Gets the file filter of the .
- ///
public override string FileFilter
{
get
{
- return string.Format("{0} (*.sqlite)|*.sqlite", HydraRingResources.SelectDatabaseFile_FilterName);
+ return string.Format("{0} (*.sqlite)|*.sqlite", HydraRingResources.SelectHydraulicBoundaryDatabaseFile_FilterName);
}
}
- ///
- /// Sets the action to perform when progress has changed.
- ///
public override ProgressChangedDelegate ProgressChanged { protected get; set; }
- ///
- /// Validates the file at and sets the version.
- ///
- /// The path to the file.
- public void ValidateFile(string filePath)
+ public string GetHydraulicBoundaryDatabaseVersion(string filePath)
{
- try
+ using (var hydraulicBoundaryDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(filePath))
{
- using (var hydraulicBoundaryDatabaseReader = new HydraulicBoundarySqLiteDatabaseReader(filePath))
- {
- Version = hydraulicBoundaryDatabaseReader.Version;
- }
+ return hydraulicBoundaryDatabaseReader.Version;
}
- catch (CriticalFileReadException e)
- {
- HandleException(e);
- }
}
- ///
- /// This method imports the data to an item from a file at the given location.
- ///
- /// The item to perform the import on.
- /// The path of the file to import the data from.
- /// True if the import was successful. False otherwise.
public override bool Import(object targetItem, string filePath)
{
var importResult = ReadHydraulicBoundaryLocations(filePath);
- if (!importResult.CriticalErrorOccurred)
+ if (importResult.CriticalErrorOccurred)
{
- if (!ImportIsCancelled)
- {
- AddImportedDataToModel(targetItem, importResult);
- log.Info(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_Import_successful);
- return true;
- }
-
+ return false;
+ }
+ if (ImportIsCancelled)
+ {
log.Info(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_cancelled);
ImportIsCancelled = false;
+
+ return false;
}
- return false;
+ AddImportedDataToModel(targetItem, importResult);
+ log.Info(ApplicationResources.HydraulicBoundaryLocationsImporter_Import_Import_successful);
+ return true;
}
private ReadResult ReadHydraulicBoundaryLocations(string path)
@@ -166,7 +126,7 @@
return GetHydraulicBoundaryLocationReadResult(path, hydraulicBoundaryDatabaseReader);
}
}
- catch (CriticalFileReadException e)
+ catch (LineParseException e)
{
HandleException(e);
}
@@ -179,7 +139,8 @@
log.Error(message);
}
- private ReadResult GetHydraulicBoundaryLocationReadResult(string path, HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader)
+ private ReadResult GetHydraulicBoundaryLocationReadResult(string path,
+ HydraulicBoundarySqLiteDatabaseReader hydraulicBoundarySqLiteDatabaseReader)
{
var totalNumberOfSteps = hydraulicBoundarySqLiteDatabaseReader.Count;
var currentStep = 1;
@@ -191,9 +152,9 @@
{
return new ReadResult(false);
}
+ NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_GetHydraulicBoundaryLocationReadResult, currentStep++, totalNumberOfSteps);
try
{
- NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_GetHydraulicBoundaryLocationReadResult, currentStep++, totalNumberOfSteps);
locations.Add(hydraulicBoundarySqLiteDatabaseReader.ReadLocation());
}
catch (CriticalFileReadException e)
@@ -214,7 +175,8 @@
var targetCollection = (ICollection) target;
int totalCount = imported.ImportedItems.Count;
- NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_Adding_imported_data_to_model, totalCount, totalCount);
+ NotifyProgress(ApplicationResources.HydraulicBoundaryLocationsImporter_Adding_imported_data_to_model,
+ totalCount, totalCount);
foreach (var item in imported.ImportedItems)
{
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.Designer.cs
===================================================================
diff -u -r26346cdbee096c58b9a2ca5fb3dad932f5827f3a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 26346cdbee096c58b9a2ca5fb3dad932f5827f3a)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -61,7 +61,7 @@
}
///
- /// Looks up a localized string similar to Geïmporteerde data toevoegen aan faalmechanisme.
+ /// Looks up a localized string similar to Geïmporteerde hydraulische randvoorwaarde locaties toevoegen aan traject..
///
public static string HydraulicBoundaryLocationsImporter_Adding_imported_data_to_model {
get {
Index: Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.resx
===================================================================
diff -u -r26346cdbee096c58b9a2ca5fb3dad932f5827f3a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 26346cdbee096c58b9a2ca5fb3dad932f5827f3a)
+++ Ringtoets/HydraRing/src/Ringtoets.HydraRing.Plugin/Properties/Resources.resx (.../Resources.resx) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -118,7 +118,7 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- Geïmporteerde data toevoegen aan faalmechanisme
+ Geïmporteerde hydraulische randvoorwaarde locaties toevoegen aan traject.
{0} Het bestand wordt overgeslagen.
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Data.Test/Properties/AssemblyInfo.cs
===================================================================
diff -u -rcdfaae2472e96c6792dd4cc303e4b8a1cbbb2a3c -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Data.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision cdfaae2472e96c6792dd4cc303e4b8a1cbbb2a3c)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Data.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -22,35 +22,7 @@
using System.Reflection;
using System.Runtime.InteropServices;
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
[assembly: AssemblyTitle("Ringtoets.HydraRing.Data.Test")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Ringtoets.HydraRing.Data.Test")]
-[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("BFD6A78A-237A-413F-8DC3-8EC6E8C5809C")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: Guid("BFD6A78A-237A-413F-8DC3-8EC6E8C5809C")]
\ No newline at end of file
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryDatabaseReaderTest.cs
===================================================================
diff -u -rc6dd26c14af11a7e13f783f578466e46b463165a -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryDatabaseReaderTest.cs (.../HydraulicBoundaryDatabaseReaderTest.cs) (revision c6dd26c14af11a7e13f783f578466e46b463165a)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/HydraulicBoundaryDatabaseReaderTest.cs (.../HydraulicBoundaryDatabaseReaderTest.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -108,7 +108,7 @@
}
[Test]
- public void ReadLocation_InvalidColums_ThrowsCriticalFileReadException()
+ public void ReadLocation_InvalidColums_ThrowsLineParseException()
{
// Setup
var dbFile = Path.Combine(testDataPath, "corruptschema.sqlite");
@@ -123,7 +123,7 @@
TestDelegate test = () => hydraulicBoundarySqLiteDatabaseReader.ReadLocation();
// Assert
- var exception = Assert.Throws(test);
+ var exception = Assert.Throws(test);
Assert.AreEqual(expectedMessage, exception.Message);
Assert.IsInstanceOf(exception.InnerException);
}
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj
===================================================================
diff -u -r548ead9fc1ba29b00b8cd715ba5a5cdc46be4a67 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 548ead9fc1ba29b00b8cd715ba5a5cdc46be4a67)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.IO.Test/Ringtoets.HydraRing.IO.Test.csproj (.../Ringtoets.HydraRing.IO.Test.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -85,6 +85,9 @@
Ringtoets.HydraRing.IO
+
+
+
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryLocationsImporterTest.cs
===================================================================
diff -u -r2310b1df9f3fcfa1e01ee6eec2206a4dd0f38f5c -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryLocationsImporterTest.cs (.../HydraulicBoundaryLocationsImporterTest.cs) (revision 2310b1df9f3fcfa1e01ee6eec2206a4dd0f38f5c)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/HydraulicBoundaryLocationsImporterTest.cs (.../HydraulicBoundaryLocationsImporterTest.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -21,10 +21,12 @@
using System;
using System.Collections.Generic;
+using System.Data.SQLite;
using System.IO;
using System.Linq;
using Core.Common.Base;
using Core.Common.Base.IO;
+using Core.Common.IO.Exceptions;
using Core.Common.TestUtil;
using Core.Common.Utils.Builders;
using NUnit.Framework;
@@ -53,66 +55,78 @@
[Test]
public void DefaultConstructor_ExpectedValues()
{
- // Prepare
- var expectedFileFilter = string.Format("{0} (*.sqlite)|*.sqlite", RingtoetsHydraRingFormsResources.SelectDatabaseFile_FilterName);
+ // Setup
+ var expectedFileFilter = string.Format("{0} (*.sqlite)|*.sqlite", RingtoetsHydraRingFormsResources.SelectHydraulicBoundaryDatabaseFile_FilterName);
+ var expectedDisplayName = "Locaties van de hydraulische randvoorwaarden";
// Call
var importer = new HydraulicBoundaryLocationsImporter();
// Assert
Assert.IsInstanceOf(importer);
- Assert.AreEqual(RingtoetsHydraRingFormsResources.HydraulicBoundaryLocationsCollection_DisplayName, importer.Name);
+ Assert.AreEqual(expectedDisplayName, importer.Name);
Assert.AreEqual(RingtoetsFormsResources.Ringtoets_Category, importer.Category);
Assert.AreEqual(16, importer.Image.Width);
Assert.AreEqual(16, importer.Image.Height);
- Assert.AreEqual(typeof(HydraulicBoundaryLocation), importer.SupportedItemType);
+ Assert.AreEqual(typeof(ICollection), importer.SupportedItemType);
Assert.AreEqual(expectedFileFilter, importer.FileFilter);
- Assert.IsNull(importer.Version);
}
[Test]
- [TestCase("/")]
- [TestCase("nonexisting.sqlite")]
- public void ValidateFile_NonExistingFileOrInvalidFile_LogError(string filename)
+ public void GetHydraulicBoundaryDatabaseVersion_NonExistingFile_ThrowsCriticalFileReadException()
{
// Setup
- string filePath = Path.Combine(testDataPath, filename);
+ string filePath = Path.Combine(testDataPath, "nonexisting.sqlite");
var importer = new HydraulicBoundaryLocationsImporter();
- var expectedMessage = string.Format(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped, String.Empty);
+ var expectedExceptionMessage = String.Format("Fout bij het lezen van bestand '{0}': Het bestand bestaat niet.", filePath);
// Call
- Action call = () => importer.ValidateFile(filePath);
+ TestDelegate test = () => importer.GetHydraulicBoundaryDatabaseVersion(filePath);
// Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- string[] messageArray = messages.ToArray();
- StringAssert.EndsWith(expectedMessage, messageArray[0]);
- });
+ CriticalFileReadException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedExceptionMessage, exception.Message);
}
[Test]
- public void ValidateFile_ValidFile_GetDatabaseVersion()
+ public void GetHydraulicBoundaryDatabaseVersion_InvalidFile_ThrowsCriticalFileReadException()
{
// Setup
+ string filePath = Path.Combine(testDataPath, "/");
+ var importer = new HydraulicBoundaryLocationsImporter();
+ var expectedExceptionMessage = String.Format("Fout bij het lezen van bestand '{0}': Bestandspad mag niet naar een map verwijzen.", filePath);
+
+ // Call
+ TestDelegate test = () => importer.GetHydraulicBoundaryDatabaseVersion(filePath);
+
+ // Assert
+ CriticalFileReadException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedExceptionMessage, exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ }
+
+ [Test]
+ public void GetHydraulicBoundaryDatabaseVersion_ValidFile_GetDatabaseVersion()
+ {
+ // Setup
string validFilePath = Path.Combine(testDataPath, "complete.sqlite");
var importer = new HydraulicBoundaryLocationsImporter();
// Call
- importer.ValidateFile(validFilePath);
+ string version = importer.GetHydraulicBoundaryDatabaseVersion(validFilePath);
// Assert
- Assert.IsNotNullOrEmpty(importer.Version);
+ Assert.IsNotNullOrEmpty(version);
}
[Test]
- [TestCase("/")]
- [TestCase("nonexisting.sqlite")]
- public void Import_FromNonExistingFileOrInvalidFile_LogError(string filename)
+ [TestCase("/", "Fout bij het lezen van bestand '{0}': Bestandspad mag niet naar een map verwijzen.")]
+ [TestCase("nonexisting.sqlite", "Fout bij het lezen van bestand '{0}': Het bestand bestaat niet.")]
+ public void Import_FromNonExistingFileOrInvalidFile_ThrowsCriticalFileReadException(string filename, string exceptionMessage)
{
// Setup
string validFilePath = Path.Combine(testDataPath, filename);
- var expectedMessage = string.Format(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped, String.Empty);
+ var expectedMessage = string.Format(exceptionMessage, validFilePath);
var mocks = new MockRepository();
var observer = mocks.StrictMock();
@@ -127,18 +141,13 @@
// Precondition
CollectionAssert.IsEmpty(observableList);
- var importResult = true;
// Call
- Action call = () => importResult = importer.Import(observableList, validFilePath);
+ TestDelegate test = () => importer.Import(observableList, validFilePath);
// Assert
- TestHelper.AssertLogMessages(call, messages =>
- {
- string[] messageArray = messages.ToArray();
- StringAssert.EndsWith(expectedMessage, messageArray[0]);
- });
- Assert.IsFalse(importResult);
+ CriticalFileReadException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedMessage, exception.Message);
CollectionAssert.IsEmpty(observableList);
Assert.AreEqual(1, progress);
@@ -246,15 +255,17 @@
}
[Test]
- public void Import_ImportingToValidTargetWithEmptyFile_AbortImportAndLog()
+ public void Import_ImportingToValidTargetWithEmptyFile_ThrowsCriticalFileReadException()
{
// Setup
- string corruptPath = Path.Combine(testDataPath, "empty.sqlite");
-
var mocks = new MockRepository();
var observer = mocks.StrictMock();
mocks.ReplayAll();
+ string corruptPath = Path.Combine(testDataPath, "empty.sqlite");
+ var expectedExceptionMessage = new FileReaderErrorMessageBuilder(corruptPath).
+ Build(RingtoetsHydraRingIOResources.Error_HydraulicBoundaryLocation_read_from_database);
+
var importer = new HydraulicBoundaryLocationsImporter
{
ProgressChanged = IncrementProgress
@@ -263,20 +274,14 @@
var observableHydraulicBoundaryLocationList = new ObservableList();
observableHydraulicBoundaryLocationList.Attach(observer);
- var importResult = true;
-
// Call
- Action call = () => importResult = importer.Import(observableHydraulicBoundaryLocationList, corruptPath);
+ TestDelegate test = () => importer.Import(observableHydraulicBoundaryLocationList, corruptPath);
// Assert
-
- var internalErrorMessage = new FileReaderErrorMessageBuilder(corruptPath).Build(RingtoetsHydraRingIOResources.Error_HydraulicBoundaryLocation_read_from_database);
- var expectedLogMessage = string.Format(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped,
- internalErrorMessage);
-
- TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 1);
- Assert.IsFalse(importResult);
- CollectionAssert.IsEmpty(observableHydraulicBoundaryLocationList, "No items should be added to collection when importin an empty database.");
+ CriticalFileReadException exception = Assert.Throws(test);
+ Assert.AreEqual(expectedExceptionMessage, exception.Message);
+ Assert.IsInstanceOf(exception.InnerException);
+ CollectionAssert.IsEmpty(observableHydraulicBoundaryLocationList, "No items should be added to collection when import in an empty database.");
Assert.AreEqual(1, progress);
mocks.VerifyAll(); // Expect no calls on 'observer'
@@ -286,12 +291,13 @@
public void Import_ImportingFileWithCorruptSchema_AbortAndLog()
{
// Setup
- string corruptPath = Path.Combine(testDataPath, "corruptschema.sqlite");
-
var mocks = new MockRepository();
var observer = mocks.StrictMock();
mocks.ReplayAll();
+ string corruptPath = Path.Combine(testDataPath, "corruptschema.sqlite");
+ var expectedLogMessage = string.Format("Fout bij het lezen van bestand '{0}': Kritieke fout opgetreden bij het uitlezen van waardes uit kolommen in de database. Het bestand wordt overgeslagen.", corruptPath);
+
var importer = new HydraulicBoundaryLocationsImporter
{
ProgressChanged = IncrementProgress
@@ -306,8 +312,6 @@
Action call = () => importResult = importer.Import(observableHydraulicBoundaryLocationList, corruptPath);
// Assert
- var expectedLogMessage = string.Format(RingtoetsHydraRingPluginResources.HydraulicBoundaryLocationsImporter_CriticalErrorMessage_0_File_Skipped, corruptPath);
-
TestHelper.AssertLogMessageIsGenerated(call, expectedLogMessage, 1);
Assert.IsFalse(importResult);
CollectionAssert.IsEmpty(observableHydraulicBoundaryLocationList, "No items should be added to collection when import from corrupt database.");
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Properties/AssemblyInfo.cs
===================================================================
diff -u -r98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 98fc85d8cecf9edae9fe7c1f2f47b60ecda5e187)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Properties/AssemblyInfo.cs (.../AssemblyInfo.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -28,13 +28,5 @@
[assembly: AssemblyTitle("Ringtoets.HydraRing.Plugin.Test")]
[assembly: AssemblyProduct("Ringtoets.HydraRing.Plugin.Test")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-
[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-
[assembly: Guid("B4C237B2-88B4-4A39-925A-BA0ED2F34D23")]
\ No newline at end of file
Index: Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj
===================================================================
diff -u -r548ead9fc1ba29b00b8cd715ba5a5cdc46be4a67 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj (.../Ringtoets.HydraRing.Plugin.Test.csproj) (revision 548ead9fc1ba29b00b8cd715ba5a5cdc46be4a67)
+++ Ringtoets/HydraRing/test/Ringtoets.HydraRing.Plugin.Test/Ringtoets.HydraRing.Plugin.Test.csproj (.../Ringtoets.HydraRing.Plugin.Test.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -1,6 +1,5 @@
-
Debug
x86
@@ -33,7 +32,7 @@
pdbonly
- true
+ true
bin\Release\
TRACE
prompt
@@ -51,6 +50,7 @@
+
..\..\..\..\packages\System.Data.SQLite.Core.1.0.99.0\lib\net40\System.Data.SQLite.dll
True
@@ -72,6 +72,10 @@
{3BBFD65B-B277-4E50-AE6D-BD24C3434609}
Core.Common.Base
+
+ {E344867E-9AC9-44C8-88A5-8185681679A9}
+ Core.Common.IO
+
{f49bd8b2-332a-4c91-a196-8cce0a2c7d98}
Core.Common.Utils
Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs
===================================================================
diff -u -r2e291a9b0eab6c47e06c4d2997e7135a5c8a1467 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 2e291a9b0eab6c47e06c4d2997e7135a5c8a1467)
+++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsGuiPlugin.cs (.../RingtoetsGuiPlugin.cs) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -30,6 +30,7 @@
using Core.Common.Gui.ContextMenu;
using Core.Common.Gui.Forms;
using Core.Common.Gui.Plugin;
+using Core.Common.IO.Exceptions;
using log4net;
using Ringtoets.Common.Data;
using Ringtoets.Common.Forms.PresentationObjects;
@@ -414,10 +415,10 @@
private void SelectDatabaseFile(HydraulicBoundaryDatabaseContext nodeData)
{
- var windowTitle = HydraringResources.SelectDatabaseFile_Title;
+ var windowTitle = HydraringResources.SelectHydraulicBoundaryDatabaseFile_Title;
using (var dialog = new OpenFileDialog
{
- Filter = string.Format("{0} (*.sqlite)|*.sqlite", HydraringResources.SelectDatabaseFile_FilterName),
+ Filter = string.Format("{0} (*.sqlite)|*.sqlite", HydraringResources.SelectHydraulicBoundaryDatabaseFile_FilterName),
Multiselect = false,
Title = windowTitle,
RestoreDirectory = true,
@@ -434,28 +435,33 @@
private static void ValidateAndImportSelectedFile(HydraulicBoundaryDatabaseContext nodeData, string selectedFile)
{
var hydraulicBoundaryLocationsImporter = new HydraulicBoundaryLocationsImporter();
-
- hydraulicBoundaryLocationsImporter.ValidateFile(selectedFile);
-
+ string newVersion;
+ try
+ {
+ newVersion = hydraulicBoundaryLocationsImporter.GetHydraulicBoundaryDatabaseVersion(selectedFile);
+ }
+ catch (CriticalFileReadException exception)
+ {
+ log.Error(exception.Message, exception);
+ return;
+ }
var currentVersion = nodeData.BoundaryDatabase.Version;
- var newVersion = hydraulicBoundaryLocationsImporter.Version;
-
var currentFilePath = nodeData.BoundaryDatabase.FilePath;
var newFilePath = selectedFile;
// Compare
if ((!string.IsNullOrEmpty(currentFilePath) && currentFilePath != newFilePath) ||
- (!string.IsNullOrEmpty(currentVersion) && currentVersion != newVersion))
+ (!string.IsNullOrEmpty(currentVersion) && currentVersion != newVersion))
{
// Show dialog
ShowCleanDialog(nodeData, hydraulicBoundaryLocationsImporter, selectedFile, newVersion);
return;
}
- // Only import inmediatly when there is nothing set.
+ // Only import immediately when there is nothing set.
if (string.IsNullOrEmpty(currentFilePath) && string.IsNullOrEmpty(currentVersion) && nodeData.BoundaryDatabase.Locations.Count == 0)
{
- ImportSelectedFile(nodeData, hydraulicBoundaryLocationsImporter, selectedFile, newVersion);
+ ImportSelectedFile(nodeData, hydraulicBoundaryLocationsImporter, selectedFile, newVersion);
}
}
Fisheye: Tag 16fef01c5d2d8ef8d15c652585efa85125ba7b25 refers to a dead (removed) revision in file `Ringtoets/Piping/src/Ringtoets.Piping.IO/Exceptions/LineParseException.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj
===================================================================
diff -u -r68597fa1a4f4d31ee209873eec139f9412026bd2 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 68597fa1a4f4d31ee209873eec139f9412026bd2)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -50,7 +50,6 @@
-
Fisheye: Tag 16fef01c5d2d8ef8d15c652585efa85125ba7b25 refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Exceptions/LineParseExceptionTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -r68597fa1a4f4d31ee209873eec139f9412026bd2 -r16fef01c5d2d8ef8d15c652585efa85125ba7b25
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 68597fa1a4f4d31ee209873eec139f9412026bd2)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 16fef01c5d2d8ef8d15c652585efa85125ba7b25)
@@ -68,7 +68,6 @@
-