Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Readers/PipingConfigurationReader.cs
===================================================================
diff -u -r38d1c1735331bcf92ae5cd994d65751e678c5551 -r495d775e889a791c4c1003145d985e4742cf74cd
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Readers/PipingConfigurationReader.cs (.../PipingConfigurationReader.cs) (revision 38d1c1735331bcf92ae5cd994d65751e678c5551)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Readers/PipingConfigurationReader.cs (.../PipingConfigurationReader.cs) (revision 495d775e889a791c4c1003145d985e4742cf74cd)
@@ -32,6 +32,7 @@
using Core.Common.Utils.Builders;
using Core.Common.Utils.Reflection;
using Ringtoets.Piping.IO.Properties;
+using Ringtoets.Piping.IO.Schema;
using CoreCommonUtilsResources = Core.Common.Utils.Properties.Resources;
namespace Ringtoets.Piping.IO.Readers
@@ -151,12 +152,12 @@
{
foreach (XElement element in elements)
{
- if (element.Name == "berekening")
+ if (element.Name == PipingConfigurationSchemaIdentifiers.CalculationElement)
{
yield return ParseReadPipingCalculation(element);
}
- if (element.Name == "folder")
+ if (element.Name == PipingConfigurationSchemaIdentifiers.FolderElement)
{
yield return ParseReadPipingCalculationGroup(element);
}
@@ -165,32 +166,32 @@
private static ReadPipingCalculationGroup ParseReadPipingCalculationGroup(XElement folderElement)
{
- return new ReadPipingCalculationGroup(folderElement.Attribute("naam")?.Value,
+ return new ReadPipingCalculationGroup(folderElement.Attribute(PipingConfigurationSchemaIdentifiers.NameAttribute)?.Value,
ParseReadPipingCalculationItems(folderElement.Elements()));
}
private static ReadPipingCalculation ParseReadPipingCalculation(XElement calculationElement)
{
var constructionProperties = new ReadPipingCalculation.ConstructionProperties
{
- Name = calculationElement.Attribute("naam")?.Value,
- AssessmentLevel = GetDoubleValueFromChildElement(calculationElement, "toetspeil"),
- HydraulicBoundaryLocation = GetStringValueFromChildElement(calculationElement, "hrlocatie"),
- SurfaceLine = GetStringValueFromChildElement(calculationElement, "profielschematisatie"),
- EntryPointL = GetDoubleValueFromChildElement(calculationElement, "intredepunt"),
- ExitPointL = GetDoubleValueFromChildElement(calculationElement, "uittredepunt"),
- StochasticSoilModel = GetStringValueFromChildElement(calculationElement, "ondergrondmodel"),
- StochasticSoilProfile = GetStringValueFromChildElement(calculationElement, "ondergrondschematisatie")
+ Name = calculationElement.Attribute(PipingConfigurationSchemaIdentifiers.NameAttribute)?.Value,
+ AssessmentLevel = GetDoubleValueFromChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.AssessmentLevelElement),
+ HydraulicBoundaryLocation = GetStringValueFromChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement),
+ SurfaceLine = GetStringValueFromChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.SurfaceLineElement),
+ EntryPointL = GetDoubleValueFromChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.EntryPointElement),
+ ExitPointL = GetDoubleValueFromChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.ExitPointElement),
+ StochasticSoilModel = GetStringValueFromChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.StochasticSoilModelElement),
+ StochasticSoilProfile = GetStringValueFromChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.StochasticSoilProfileElement)
};
- XElement phreaticLevelExitElement = GetStochastChildElement(calculationElement, "polderpeil");
+ XElement phreaticLevelExitElement = GetStochastChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.PhreaticLevelExitStochastName);
if (phreaticLevelExitElement != null)
{
constructionProperties.PhreaticLevelExitMean = GetDoubleValueFromChildElement(phreaticLevelExitElement, "verwachtingswaarde");
constructionProperties.PhreaticLevelExitStandardDeviation = GetDoubleValueFromChildElement(phreaticLevelExitElement, "standaardafwijking");
}
- XElement dampingFactorExitElement = GetStochastChildElement(calculationElement, "dempingsfactor");
+ XElement dampingFactorExitElement = GetStochastChildElement(calculationElement, PipingConfigurationSchemaIdentifiers.DampingFactorExitStochastName);
if (dampingFactorExitElement != null)
{
constructionProperties.DampingFactorExitMean = GetDoubleValueFromChildElement(dampingFactorExitElement, "verwachtingswaarde");
@@ -218,7 +219,8 @@
private static XElement GetStochastChildElement(XElement parentElement, string stochastName)
{
- return parentElement.Elements("stochast").FirstOrDefault(e => e.Attribute("naam")?.Value == stochastName);
+ return parentElement.Elements(PipingConfigurationSchemaIdentifiers.StochastElement)
+ .FirstOrDefault(e => e.Attribute(PipingConfigurationSchemaIdentifiers.NameAttribute)?.Value == stochastName);
}
}
}
\ No newline at end of file
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj
===================================================================
diff -u -r693cdb62ee142136d80bc08f36fa506fe9c64438 -r495d775e889a791c4c1003145d985e4742cf74cd
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 693cdb62ee142136d80bc08f36fa506fe9c64438)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Ringtoets.Piping.IO.csproj (.../Ringtoets.Piping.IO.csproj) (revision 495d775e889a791c4c1003145d985e4742cf74cd)
@@ -63,6 +63,7 @@
+
Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Schema/PipingConfigurationSchemaIdentifiers.cs
===================================================================
diff -u
--- Ringtoets/Piping/src/Ringtoets.Piping.IO/Schema/PipingConfigurationSchemaIdentifiers.cs (revision 0)
+++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Schema/PipingConfigurationSchemaIdentifiers.cs (revision 495d775e889a791c4c1003145d985e4742cf74cd)
@@ -0,0 +1,94 @@
+// 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.
+
+namespace Ringtoets.Piping.IO.Schema
+{
+ ///
+ /// Container of identifiers related to the piping configuration schema definition.
+ ///
+ public static class PipingConfigurationSchemaIdentifiers
+ {
+ ///
+ /// Gets the identifier for calculation elements.
+ ///
+ public static string CalculationElement => "berekening";
+
+ ///
+ /// Gets the identifier for folder elements.
+ ///
+ public static string FolderElement => "folder";
+
+ ///
+ /// Gets the identifier for name attributes.
+ ///
+ public static string NameAttribute => "naam";
+
+ ///
+ /// Gets the identifier for assessment level elements.
+ ///
+ public static string AssessmentLevelElement => "toetspeil";
+
+ ///
+ /// Gets the identifier for hydraulic boundary location elements.
+ ///
+ public static string HydraulicBoundaryLocationElement => "hrlocatie";
+
+ ///
+ /// Gets the identifier for surface line elements.
+ ///
+ public static string SurfaceLineElement => "profielschematisatie";
+
+ ///
+ /// Gets the identifier for entry point elements.
+ ///
+ public static string EntryPointElement => "intredepunt";
+
+ ///
+ /// Gets the identifier for exit point elements.
+ ///
+ public static string ExitPointElement => "uittredepunt";
+
+ ///
+ /// Gets the identifier for stochastic soil model elements.
+ ///
+ public static string StochasticSoilModelElement => "ondergrondmodel";
+
+ ///
+ /// Gets the identifier for stochastic soil profile elements.
+ ///
+ public static string StochasticSoilProfileElement => "ondergrondschematisatie";
+
+ ///
+ /// Gets the identifier for stochast elements.
+ ///
+ public static string StochastElement => "stochast";
+
+ ///
+ /// Gets the identifier for the phreatic level exit stochast names.
+ ///
+ public static string PhreaticLevelExitStochastName => "polderpeil";
+
+ ///
+ /// Gets the identifier for the damping factor exit stochast names.
+ ///
+ public static string DampingFactorExitStochastName => "dempingsfactor";
+ }
+}
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -r693cdb62ee142136d80bc08f36fa506fe9c64438 -r495d775e889a791c4c1003145d985e4742cf74cd
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 693cdb62ee142136d80bc08f36fa506fe9c64438)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 495d775e889a791c4c1003145d985e4742cf74cd)
@@ -80,6 +80,7 @@
+
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Schema/PipingConfigurationSchemaIdentifiersTest.cs
===================================================================
diff -u
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Schema/PipingConfigurationSchemaIdentifiersTest.cs (revision 0)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Schema/PipingConfigurationSchemaIdentifiersTest.cs (revision 495d775e889a791c4c1003145d985e4742cf74cd)
@@ -0,0 +1,48 @@
+// 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;
+using Ringtoets.Piping.IO.Schema;
+
+namespace Ringtoets.Piping.IO.Test.Schema
+{
+ [TestFixture]
+ public class PipingConfigurationSchemaIdentifiersTest
+ {
+ [Test]
+ public void PipingConfigurationSchemaIdentifiers_ExpectedValues()
+ {
+ Assert.AreEqual("berekening", PipingConfigurationSchemaIdentifiers.CalculationElement);
+ Assert.AreEqual("folder", PipingConfigurationSchemaIdentifiers.FolderElement);
+ Assert.AreEqual("naam", PipingConfigurationSchemaIdentifiers.NameAttribute);
+ Assert.AreEqual("toetspeil", PipingConfigurationSchemaIdentifiers.AssessmentLevelElement);
+ Assert.AreEqual("hrlocatie", PipingConfigurationSchemaIdentifiers.HydraulicBoundaryLocationElement);
+ Assert.AreEqual("profielschematisatie", PipingConfigurationSchemaIdentifiers.SurfaceLineElement);
+ Assert.AreEqual("intredepunt", PipingConfigurationSchemaIdentifiers.EntryPointElement);
+ Assert.AreEqual("uittredepunt", PipingConfigurationSchemaIdentifiers.ExitPointElement);
+ Assert.AreEqual("ondergrondmodel", PipingConfigurationSchemaIdentifiers.StochasticSoilModelElement);
+ Assert.AreEqual("ondergrondschematisatie", PipingConfigurationSchemaIdentifiers.StochasticSoilProfileElement);
+ Assert.AreEqual("stochast", PipingConfigurationSchemaIdentifiers.StochastElement);
+ Assert.AreEqual("polderpeil", PipingConfigurationSchemaIdentifiers.PhreaticLevelExitStochastName);
+ Assert.AreEqual("dempingsfactor", PipingConfigurationSchemaIdentifiers.DampingFactorExitStochastName);
+ }
+ }
+}
\ No newline at end of file