Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj =================================================================== diff -u -r94cf291c6814829fe9ea122b80e5e36a4f86486f -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj (.../Application.Ringtoets.Migration.csproj) (revision 94cf291c6814829fe9ea122b80e5e36a4f86486f) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Application.Ringtoets.Migration.csproj (.../Application.Ringtoets.Migration.csproj) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -107,7 +107,7 @@ - + Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs =================================================================== diff -u -r94cf291c6814829fe9ea122b80e5e36a4f86486f -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 94cf291c6814829fe9ea122b80e5e36a4f86486f) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -84,7 +84,7 @@ /// /// Looks up a localized string similar to /* ---------------------------------------------------- */ ////* Generated by Enterprise Architect Version 12.0 */ - ////* Created On : 12-Jan-2017 2:31:23 PM */ + ////* Created On : 31-Jan-2017 10:19:09 */ ////* DBMS : SQLite */ ////* ---------------------------------------------------- */ /// @@ -102,7 +102,7 @@ ///DROP TABLE IF EXISTS 'StabilityPointStructuresCalculationEntity' ///; /// - ///DROP TABLE IF E [rest of string was truncated]";. + ///DROP TABLE IF EXI [rest of string was truncated]";. /// public static string DatabaseStructure17_1 { get { @@ -111,19 +111,23 @@ } /// - /// Looks up a localized string similar to PRAGMA foreign_keys = OFF; + /// Looks up a localized string similar to /* + ///Migration script for migrating Ringtoets databases. + ///SourceProject version: 5 + ///TargetProject version: 17.1 + ///*/ + ///PRAGMA foreign_keys = OFF; /// ///ATTACH DATABASE [{0}] AS SOURCEPROJECT; /// ///INSERT INTO AssessmentSectionEntity SELECT * FROM [SOURCEPROJECT].AssessmentSectionEntity; ///INSERT INTO CalculationGroupEntity SELECT * FROM [SOURCEPROJECT].CalculationGroupEntity; ///INSERT INTO CharacteristicPointEntity SELECT * FROM [SOURCEPROJECT].CharacteristicPointEntity; - ///INSERT INTO ClosingStructureEntity SELECT * FROM [SOURCEPROJECT].ClosingStructureEntity; - ///INSERT INTO ClosingStructuresFailureMechanismMetaEntity SELECT * FROM [ [rest of string was truncated]";. + ///INSERT INTO ClosingStructureEntity SELECT * F [rest of string was truncated]";. /// - public static string Migration_4_171 { + public static string Migration_5_171 { get { - return ResourceManager.GetString("Migration_4_171", resourceCulture); + return ResourceManager.GetString("Migration_5_171", resourceCulture); } } Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx =================================================================== diff -u -r94cf291c6814829fe9ea122b80e5e36a4f86486f -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx (.../Resources.resx) (revision 94cf291c6814829fe9ea122b80e5e36a4f86486f) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Properties/Resources.resx (.../Resources.resx) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -121,8 +121,8 @@ ..\Resources\DatabaseStructure17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 - - ..\Resources\Migration_4_17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\Resources\Migration_5_17.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 Het bestand '{0}' is moet een geldig Ringtoets database bestand zijn. Fisheye: Tag 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd refers to a dead (removed) revision in file `Application/Ringtoets/src/Application.Ringtoets.Migration/Resources/Migration_4_17.1.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: Application/Ringtoets/src/Application.Ringtoets.Migration/Resources/Migration_5_17.1.sql =================================================================== diff -u --- Application/Ringtoets/src/Application.Ringtoets.Migration/Resources/Migration_5_17.1.sql (revision 0) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/Resources/Migration_5_17.1.sql (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -0,0 +1,119 @@ +/* +Migration script for migrating Ringtoets databases. +SourceProject version: 5 +TargetProject version: 17.1 +*/ +PRAGMA foreign_keys = OFF; + +ATTACH DATABASE [{0}] AS SOURCEPROJECT; + +INSERT INTO AssessmentSectionEntity SELECT * FROM [SOURCEPROJECT].AssessmentSectionEntity; +INSERT INTO CalculationGroupEntity SELECT * FROM [SOURCEPROJECT].CalculationGroupEntity; +INSERT INTO CharacteristicPointEntity SELECT * FROM [SOURCEPROJECT].CharacteristicPointEntity; +INSERT INTO ClosingStructureEntity SELECT * FROM [SOURCEPROJECT].ClosingStructureEntity; +INSERT INTO ClosingStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].ClosingStructureFailureMechanismMetaEntity; +INSERT INTO ClosingStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresCalculationEntity; +INSERT INTO ClosingStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresOutputEntity; +INSERT INTO ClosingStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].ClosingStructuresSectionResultEntity; +INSERT INTO DikeProfileEntity SELECT * FROM [SOURCEPROJECT].DikeProfileEntity; +INSERT INTO DuneErosionSectionResultEntity SELECT * FROM [SOURCEPROJECT].DuneErosionSectionResultEntity; +INSERT INTO FailureMechanismEntity SELECT * FROM [SOURCEPROJECT].FailureMechanismEntity; +INSERT INTO FailureMechanismSectionEntity SELECT * FROM [SOURCEPROJECT].FailureMechanismSectionEntity; +INSERT INTO ForeshoreProfileEntity SELECT * FROM [SOURCEPROJECT].ForeshoreProfileEntity; +INSERT INTO GrassCoverErosionInwardsCalculationEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsCalculationEntity; +INSERT INTO GrassCoverErosionInwardsDikeHeightOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsDikeHeightOutputEntity; +INSERT INTO GrassCoverErosionInwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsFailureMechanismMetaEntity; +INSERT INTO GrassCoverErosionInwardsOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsOutputEntity; +INSERT INTO GrassCoverErosionInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionInwardsSectionResultEntity; +INSERT INTO GrassCoverErosionOutwardsFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsFailureMechanismMetaEntity; +INSERT INTO GrassCoverErosionOutwardsHydraulicLocationEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsHydraulicLocationEntity; +INSERT INTO GrassCoverErosionOutwardsHydraulicLocationOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsHydraulicLocationOutputEntity; +INSERT INTO GrassCoverErosionOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsSectionResultEntity; +INSERT INTO GrassCoverErosionOutwardsWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsWaveConditionsCalculationEntity; +INSERT INTO GrassCoverErosionOutwardsWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].GrassCoverErosionOutwardsWaveConditionsOutputEntity; +INSERT INTO GrassCoverSlipOffInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffInwardsSectionResultEntity; +INSERT INTO GrassCoverSlipOffOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].GrassCoverSlipOffOutwardsSectionResultEntity; +INSERT INTO HeightStructureEntity SELECT * FROM [SOURCEPROJECT].HeightStructureEntity; +INSERT INTO HeightStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresCalculationEntity; +INSERT INTO HeightStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresFailureMechanismMetaEntity; +INSERT INTO HeightStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresOutputEntity; +INSERT INTO HeightStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].HeightStructuresSectionResultEntity; +INSERT INTO HydraulicLocationEntity SELECT * FROM [SOURCEPROJECT].HydraulicLocationEntity; +INSERT INTO HydraulicLocationOutputEntity SELECT * FROM [SOURCEPROJECT].HydraulicLocationOutputEntity; +INSERT INTO MacrostabilityInwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].MacrostabilityInwardsSectionResultEntity; +INSERT INTO MacrostabilityOutwardsSectionResultEntity SELECT * FROM [SOURCEPROJECT].MacrostabilityOutwardsSectionResultEntity; +INSERT INTO MicrostabilitySectionResultEntity SELECT * FROM [SOURCEPROJECT].MicrostabilitySectionResultEntity; +INSERT INTO PipingCalculationEntity SELECT * FROM [SOURCEPROJECT].PipingCalculationEntity; +INSERT INTO PipingCalculationOutputEntity SELECT * FROM [SOURCEPROJECT].PipingCalculationOutputEntity; +INSERT INTO PipingFailureMechanismMetaEntity ( + [PipingFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [A], + [WaterVolumetricWeight], + [StochasticSoilModelSourcePath]) +SELECT [PipingFailureMechanismMetaEntityId], + [FailureMechanismEntityId], + [A], + [WaterVolumetricWeight], + "Onbekend" FROM [SOURCEPROJECT].PipingFailureMechanismMetaEntity; +INSERT INTO PipingSectionResultEntity SELECT * FROM [SOURCEPROJECT].PipingSectionResultEntity; +INSERT INTO PipingSemiProbabilisticOutputEntity SELECT * FROM [SOURCEPROJECT].PipingSemiProbabilisticOutputEntity; +INSERT INTO PipingStructureSectionResultEntity SELECT * FROM [SOURCEPROJECT].PipingStructureSectionResultEntity; +INSERT INTO ProjectEntity SELECT * FROM [SOURCEPROJECT].ProjectEntity; +INSERT INTO SoilLayerEntity SELECT * FROM [SOURCEPROJECT].SoilLayerEntity; +INSERT INTO SoilProfileEntity SELECT * FROM [SOURCEPROJECT].SoilProfileEntity; +INSERT INTO StabilityPointStructureEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructureEntity; +INSERT INTO StabilityPointStructuresCalculationEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresCalculationEntity; +INSERT INTO StabilityPointStructuresFailureMechanismMetaEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresFailureMechanismMetaEntity; +INSERT INTO StabilityPointStructuresOutputEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresOutputEntity; +INSERT INTO StabilityPointStructuresSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityPointStructuresSectionResultEntity; +INSERT INTO StabilityStoneCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverSectionResultEntity; +INSERT INTO StabilityStoneCoverWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsCalculationEntity; +INSERT INTO StabilityStoneCoverWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].StabilityStoneCoverWaveConditionsOutputEntity; +INSERT INTO StochasticSoilModelEntity SELECT * FROM [SOURCEPROJECT].StochasticSoilModelEntity; +INSERT INTO StochasticSoilProfileEntity SELECT * FROM [SOURCEPROJECT].StochasticSoilProfileEntity; +INSERT INTO StrengthStabilityLengthwiseConstructionSectionResultEntity SELECT * FROM [SOURCEPROJECT].StrengthStabilityLengthwiseConstructionSectionResultEntity; +INSERT INTO SurfaceLineEntity SELECT * FROM [SOURCEPROJECT].SurfaceLineEntity; +INSERT INTO TechnicalInnovationSectionResultEntity SELECT * FROM [SOURCEPROJECT].TechnicalInnovationSectionResultEntity; +INSERT INTO VersionEntity ( + [VersionId], + [Version], + [Timestamp], + [FingerPrint]) +SELECT [VersionId], + "17.1", + [Timestamp], + [FingerPrint] + FROM [SOURCEPROJECT].VersionEntity; +INSERT INTO WaterPressureAsphaltCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].WaterPressureAsphaltCoverSectionResultEntity; +INSERT INTO WaveImpactAsphaltCoverSectionResultEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverSectionResultEntity; +INSERT INTO WaveImpactAsphaltCoverWaveConditionsCalculationEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverWaveConditionsCalculationEntity; +INSERT INTO WaveImpactAsphaltCoverWaveConditionsOutputEntity SELECT * FROM [SOURCEPROJECT].WaveImpactAsphaltCoverWaveConditionsOutputEntity; + +/* +Remove Outputs +*/ + + +/* +Insert new data +*/ +INSERT INTO DuneErosionFailureMechanismMetaEntity ( + [FailureMechanismEntityId], + [N]) +SELECT FailureMechanismEntityId, + 2.0 + FROM FailureMechanismEntity WHERE FailureMechanismType = 8 LIMIT 1; +INSERT INTO BackgroundMapDataEntity ( + [AssessmentSectionEntityId], + [Name], + [IsVisible], + [Transparency]) +SELECT AssessmentSectionEntityId, + "", + 0, + 0.0 + FROM AssessmentSectionEntity; + +DETACH SOURCEPROJECT; +PRAGMA foreign_keys = ON; \ No newline at end of file Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs =================================================================== diff -u -r56e690b056dd0901609e651f6ac3c010d3d002b7 -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs (.../RingtoetsCreateScript.cs) (revision 56e690b056dd0901609e651f6ac3c010d3d002b7) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsCreateScript.cs (.../RingtoetsCreateScript.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -24,6 +24,7 @@ using Application.Ringtoets.Migration.Properties; using Migration.Scripts.Data; using Migration.Scripts.Data.Exceptions; +using Ringtoets.Common.Utils; namespace Application.Ringtoets.Migration { @@ -41,11 +42,15 @@ /// The SQL query that belongs to . /// Thrown when: /// - /// is empty or null, + /// is empty, null, or not a valid Ringtoets database version, /// is empty, null, or consist out of only whitespace characters. /// public RingtoetsCreateScript(string version, string query) : base(version) { + if (!RingtoetsVersionHelper.IsValidVersion(version)) + { + throw new ArgumentException($@"{version} is not a valid Ringtoets database version.", nameof(version)); + } if (string.IsNullOrWhiteSpace(query)) { throw new ArgumentException(@"Query must have a value.", nameof(query)); Index: Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs =================================================================== diff -u -r59e7b9604b09b292bf3b76c729751e7622d36bce -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs (.../RingtoetsUpgradeScript.cs) (revision 59e7b9604b09b292bf3b76c729751e7622d36bce) +++ Application/Ringtoets/src/Application.Ringtoets.Migration/RingtoetsUpgradeScript.cs (.../RingtoetsUpgradeScript.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -24,6 +24,7 @@ using Application.Ringtoets.Migration.Properties; using Migration.Scripts.Data; using Migration.Scripts.Data.Exceptions; +using Ringtoets.Common.Utils; namespace Application.Ringtoets.Migration { @@ -42,8 +43,8 @@ /// The SQL query to upgrade from to . /// Thrown when: /// - /// is empty or null, - /// is empty or null, + /// is empty, null, or not a valid Ringtoets database version, + /// is empty, null, or not a valid Ringtoets database version, /// is empty, null, or consists out of only whitespace characters. /// public RingtoetsUpgradeScript(string fromVersion, string toVersion, string query) @@ -53,6 +54,16 @@ { throw new ArgumentException(@"Query must have a value.", nameof(query)); } + + if (!RingtoetsVersionHelper.IsValidVersion(fromVersion)) + { + throw new ArgumentException($@"{fromVersion} is not a valid Ringtoets database version.", nameof(fromVersion)); + } + if (!RingtoetsVersionHelper.IsValidVersion(toVersion)) + { + throw new ArgumentException($@"{toVersion} is not a valid Ringtoets database version.", nameof(toVersion)); + } + upgradeQuery = query; } Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/Application.Ringtoets.Migration.Test.csproj =================================================================== diff -u -raf53f335d0fa6920f7a5c4ab27b112bae9eeaede -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/Application.Ringtoets.Migration.Test.csproj (.../Application.Ringtoets.Migration.Test.csproj) (revision af53f335d0fa6920f7a5c4ab27b112bae9eeaede) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/Application.Ringtoets.Migration.Test.csproj (.../Application.Ringtoets.Migration.Test.csproj) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -91,6 +91,10 @@ {d08db9e2-6861-44c8-a725-71a70274cc77} Migration.Scripts.Data + + {6A074D65-A81C-4C1C-8E24-F36C916E4ED7} + Ringtoets.Common.Utils + {FAC55B92-E259-43D6-B9A1-5BDA6C834359} Application.Ringtoets.Migration Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs =================================================================== diff -u -r74c998ad1d6edfc4fff8872438a84a5bd9cb0d98 -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs (.../RingtoetsCreateScriptTest.cs) (revision 74c998ad1d6edfc4fff8872438a84a5bd9cb0d98) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsCreateScriptTest.cs (.../RingtoetsCreateScriptTest.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -26,6 +26,7 @@ using Migration.Scripts.Data; using Migration.Scripts.Data.Exceptions; using NUnit.Framework; +using Ringtoets.Common.Utils; namespace Application.Ringtoets.Migration.Test { @@ -35,6 +36,7 @@ [Test] [TestCase("")] [TestCase(null)] + [TestCase("4")] public void Constructor_InvalidVersion_ThrowsArgumentException(string version) { // Setup @@ -55,7 +57,7 @@ public void Constructor_InvalidQuery_ThrowsArgumentException(string query) { // Setup - const string version = "Valid version"; + string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); // Call TestDelegate call = () => new RingtoetsCreateScript(version, query); @@ -70,7 +72,7 @@ { // Setup const string query = "Valid query"; - const string version = "Valid version"; + string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); // Call var createScript = new RingtoetsCreateScript(version, query); @@ -85,7 +87,7 @@ { // Setup const string query = ";"; - const string version = "Valid version"; + string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); string targetFilename = Path.GetRandomFileName(); string filePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, targetFilename); @@ -104,7 +106,7 @@ { // Setup const string query = ";"; - const string version = "Valid version"; + string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); string filename = Path.GetRandomFileName(); string filePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, filename); @@ -130,7 +132,7 @@ { // Setup const string query = "THIS WILL FAIL"; - const string version = "Valid version"; + string version = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); string targetFilename = Path.GetRandomFileName(); string filePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, targetFilename); Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs =================================================================== diff -u -r1141c26fc503c0955645107a51f91c8e5975d606 -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs (.../RingtoetsSqLiteDatabaseFileMigratorTest.cs) (revision 1141c26fc503c0955645107a51f91c8e5975d606) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsSqLiteDatabaseFileMigratorTest.cs (.../RingtoetsSqLiteDatabaseFileMigratorTest.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -48,7 +48,7 @@ var migrator = new RingtoetsSqLiteDatabaseFileMigrator(); // Call - bool isSupported = migrator.IsVersionSupported("4"); + bool isSupported = migrator.IsVersionSupported("5"); // Assert Assert.IsTrue(isSupported); @@ -215,7 +215,7 @@ // Assert string message = Assert.Throws(call).Message; - Assert.AreEqual($"Het is niet mogelijk om versie '4' te migreren naar versie '{newVersion}'.", message); + Assert.AreEqual($"Het is niet mogelijk om versie '5' te migreren naar versie '{newVersion}'.", message); } [Test] Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsUpgradeScriptTest.cs =================================================================== diff -u -rd4f3eeb2e013b9ed46b4a7fd21e3965f25bd763d -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsUpgradeScriptTest.cs (.../RingtoetsUpgradeScriptTest.cs) (revision d4f3eeb2e013b9ed46b4a7fd21e3965f25bd763d) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsUpgradeScriptTest.cs (.../RingtoetsUpgradeScriptTest.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -26,6 +26,7 @@ using Migration.Scripts.Data; using Migration.Scripts.Data.Exceptions; using NUnit.Framework; +using Ringtoets.Common.Utils; namespace Application.Ringtoets.Migration.Test { @@ -35,11 +36,12 @@ [Test] [TestCase("")] [TestCase(null)] + [TestCase("4")] public void Constructor_InvalidFromVersion_ThrowsArgumentException(string fromVersion) { // Setup const string query = "Valid query"; - const string toVersion = "toVersion"; + string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); // Call TestDelegate call = () => new RingtoetsUpgradeScript(fromVersion, toVersion, query); @@ -52,10 +54,11 @@ [Test] [TestCase("")] [TestCase(null)] + [TestCase("4")] public void Constructor_InvalidToVersion_ThrowsArgumentException(string toVersion) { // Setup - const string fromVersion = "fromVersion"; + string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); const string query = "Valid query"; // Call @@ -73,8 +76,8 @@ public void Constructor_InvalidQuery_ThrowsArgumentException(string query) { // Setup - const string fromVersion = "fromVersion"; - const string toVersion = "toVersion"; + string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); // Call TestDelegate call = () => new RingtoetsUpgradeScript(fromVersion, toVersion, query); @@ -88,8 +91,8 @@ public void Constructor_ValidParameters_ReturnsExpectedValues() { // Setup - const string fromVersion = "fromVersion"; - const string toVersion = "toVersion"; + string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); const string query = ";"; // Call @@ -107,8 +110,10 @@ // Setup string filename = Path.GetRandomFileName(); string filePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, filename); + string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); - var upgradeScript = new RingtoetsUpgradeScript("1", "2", "THIS WILL FAIL"); + var upgradeScript = new RingtoetsUpgradeScript(fromVersion, toVersion, "THIS WILL FAIL"); // Call TestDelegate call = () => upgradeScript.Upgrade("c:\\file.ext", "c:\\file.ext"); @@ -117,7 +122,7 @@ using (new FileDisposeHelper(filePath)) { CriticalMigrationException exception = Assert.Throws(call); - Assert.AreEqual("Het upgraden van het Ringtoets bestand versie 1 naar 2 is mislukt.", + Assert.AreEqual($"Het upgraden van het Ringtoets bestand versie {fromVersion} naar {fromVersion} is mislukt.", exception.Message); Assert.IsInstanceOf(exception.InnerException); } @@ -129,8 +134,10 @@ // Setup string filename = Path.GetRandomFileName(); string filePath = TestHelper.GetTestDataPath(TestDataPath.Application.Ringtoets.Migration, filename); + string fromVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); + string toVersion = RingtoetsVersionHelper.GetCurrentDatabaseVersion(); - var upgradeScript = new RingtoetsUpgradeScript("1", "2", ";"); + var upgradeScript = new RingtoetsUpgradeScript(fromVersion, toVersion, ";"); // Call upgradeScript.Upgrade("c:\\file.ext", filePath); Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsVersionedFileTest.cs =================================================================== diff -u -rd4f3eeb2e013b9ed46b4a7fd21e3965f25bd763d -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd --- Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsVersionedFileTest.cs (.../RingtoetsVersionedFileTest.cs) (revision d4f3eeb2e013b9ed46b4a7fd21e3965f25bd763d) +++ Application/Ringtoets/test/Application.Ringtoets.Migration.Test/RingtoetsVersionedFileTest.cs (.../RingtoetsVersionedFileTest.cs) (revision 975f383dbfa3abd403974d4159ae0bc2b0a5dfcd) @@ -98,7 +98,7 @@ } } - [TestCase("FullTestProject164.rtd", "4")] + [TestCase("FullTestProject164.rtd", "5")] [TestCase("FullTestProject171.rtd", "17.1")] public void GetVersion_ParameteredConstructor_ExptectedProperties(string file, string expectedVersion) { Index: Application/Ringtoets/test/Application.Ringtoets.Migration.Test/test-data/FullTestProject164.rtd =================================================================== diff -u -radb7a69497e2221e75420ccf5f5d7407321870dd -r975f383dbfa3abd403974d4159ae0bc2b0a5dfcd Binary files differ