Index: Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs =================================================================== diff -u -r60985085195eb7c41933b5d2983d68b88d289bc8 -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision 60985085195eb7c41933b5d2983d68b88d289bc8) +++ Migration/Core/src/Migration.Core.Storage/VersionedFileMigrator.cs (.../VersionedFileMigrator.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -72,7 +72,7 @@ /// The version to upgrade to. /// true if needs to be upgraded to , /// false otherwise. - public bool NeedsMigrate(VersionedFile versionedFile, string toVersion) + public bool NeedsMigrate(IVersionedFile versionedFile, string toVersion) { return ringtoetsVersionComparer.Compare(versionedFile.GetVersion(), toVersion) < 0; } @@ -85,7 +85,7 @@ /// The location where the migrated file needs to be saved. /// Thrown when migrating /// to a new version on location failed. - public void Migrate(VersionedFile fromVersionedFile, string toVersion, string newFileLocation) + public void Migrate(IVersionedFile fromVersionedFile, string toVersion, string newFileLocation) { if (Path.GetFullPath(fromVersionedFile.Location).Equals(Path.GetFullPath(newFileLocation))) { @@ -105,7 +105,7 @@ fromVersion, toVersion)); } - var upgradedVersionFile = migrationScript.Upgrade(fromVersionedFile); + IVersionedFile upgradedVersionFile = migrationScript.Upgrade(fromVersionedFile); if (!upgradedVersionFile.GetVersion().Equals(toVersion)) { Migrate(upgradedVersionFile, toVersion, newFileLocation); Index: Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs =================================================================== diff -u -r60985085195eb7c41933b5d2983d68b88d289bc8 -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision 60985085195eb7c41933b5d2983d68b88d289bc8) +++ Migration/Core/test/Migration.Core.Storage.Test/VersionedFileMigratorTest.cs (.../VersionedFileMigratorTest.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -79,7 +79,7 @@ { // Setup string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, "Demo164.rtd"); - VersionedFile versionedFile = new VersionedFile(sourceFilePath); + var versionedFile = new VersionedFile(sourceFilePath); var migrator = new VersionedFileMigrator(); // Call @@ -94,7 +94,7 @@ { // Setup string sourceFilePath = TestHelper.GetTestDataPath(TestDataPath.Migration.Core.Storage, "Demo164.rtd"); - VersionedFile versionedFile = new VersionedFile(sourceFilePath); + var versionedFile = new VersionedFile(sourceFilePath); var migrator = new VersionedFileMigrator(); // Call Index: Migration/Scripts/src/Migration.Scripts.Data/CreateScript.cs =================================================================== diff -u -r6846763244edb70b20baed7e886e4d9092bfae0e -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Scripts/src/Migration.Scripts.Data/CreateScript.cs (.../CreateScript.cs) (revision 6846763244edb70b20baed7e886e4d9092bfae0e) +++ Migration/Scripts/src/Migration.Scripts.Data/CreateScript.cs (.../CreateScript.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -72,7 +72,7 @@ /// /// Thrown when executing query failed. /// - public VersionedFile CreateEmptyVersionedFile(string location) + public IVersionedFile CreateEmptyVersionedFile(string location) { IOUtils.ValidateFilePathIsWritable(location); Index: Migration/Scripts/src/Migration.Scripts.Data/IVersionedFile.cs =================================================================== diff -u --- Migration/Scripts/src/Migration.Scripts.Data/IVersionedFile.cs (revision 0) +++ Migration/Scripts/src/Migration.Scripts.Data/IVersionedFile.cs (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -0,0 +1,50 @@ +// 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 Core.Common.Base.Storage; +using Core.Common.IO.Exceptions; + +namespace Migration.Scripts.Data +{ + /// + /// Interface that defines a file that has a version. + /// + public interface IVersionedFile + { + /// + /// Gets the location of the versioned file. + /// + string Location { get; } + + /// + /// Gets the version of the . + /// + /// The version. + /// Thrown when: + /// + /// No file could be found at . + /// Unable to open file at . + /// + /// + /// Thrown when is not a valid file. + string GetVersion(); + } +} \ No newline at end of file Index: Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj =================================================================== diff -u -r244fcc727a46643076dc4ed4dd9df08033ce67d8 -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj (.../Migration.Scripts.Data.csproj) (revision 244fcc727a46643076dc4ed4dd9df08033ce67d8) +++ Migration/Scripts/src/Migration.Scripts.Data/Migration.Scripts.Data.csproj (.../Migration.Scripts.Data.csproj) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -46,6 +46,7 @@ + Index: Migration/Scripts/src/Migration.Scripts.Data/MigrationScript.cs =================================================================== diff -u -rf5120263f838eaf211d8f73ca08a78c22e9777fb -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Scripts/src/Migration.Scripts.Data/MigrationScript.cs (.../MigrationScript.cs) (revision f5120263f838eaf211d8f73ca08a78c22e9777fb) +++ Migration/Scripts/src/Migration.Scripts.Data/MigrationScript.cs (.../MigrationScript.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -74,13 +74,13 @@ } /// - /// Uses to upgrade to a new . + /// Uses to upgrade to a new . /// /// - /// The upgraded . + /// The upgraded . /// Thrown when is null. /// Thrown when migration failed. - public VersionedFile Upgrade(VersionedFile sourceVersionedFile) + public IVersionedFile Upgrade(IVersionedFile sourceVersionedFile) { if (sourceVersionedFile == null) { @@ -90,7 +90,7 @@ try { - VersionedFile newVersionedFile = createScript.CreateEmptyVersionedFile(newLocation); + IVersionedFile newVersionedFile = createScript.CreateEmptyVersionedFile(newLocation); upgradeScript.Upgrade(sourceVersionedFile, newVersionedFile); return newVersionedFile; } Index: Migration/Scripts/src/Migration.Scripts.Data/UpgradeScript.cs =================================================================== diff -u -r7050299dc93fba048f82eb9e11d90c86a8508596 -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Scripts/src/Migration.Scripts.Data/UpgradeScript.cs (.../UpgradeScript.cs) (revision 7050299dc93fba048f82eb9e11d90c86a8508596) +++ Migration/Scripts/src/Migration.Scripts.Data/UpgradeScript.cs (.../UpgradeScript.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -93,7 +93,7 @@ /// is null. /// /// Thrown when executing query failed. - public void Upgrade(VersionedFile source, VersionedFile target) + public void Upgrade(IVersionedFile source, IVersionedFile target) { if (source == null) { Index: Migration/Scripts/src/Migration.Scripts.Data/VersionedFile.cs =================================================================== diff -u -rf5120263f838eaf211d8f73ca08a78c22e9777fb -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Scripts/src/Migration.Scripts.Data/VersionedFile.cs (.../VersionedFile.cs) (revision f5120263f838eaf211d8f73ca08a78c22e9777fb) +++ Migration/Scripts/src/Migration.Scripts.Data/VersionedFile.cs (.../VersionedFile.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -29,7 +29,7 @@ /// /// Class that defines a file that has a version. /// - public class VersionedFile + public class VersionedFile : IVersionedFile { /// /// Creates a new instance of the class. @@ -49,22 +49,8 @@ Location = path; } - /// - /// Gets the location of the versioned file. - /// public string Location { get; } - /// - /// Gets the version of the . - /// - /// The version. - /// Thrown when: - /// - /// No file could be found at . - /// Unable to open file at . - /// - /// - /// Thrown when is not a valid file. public string GetVersion() { using (var sourceFile = new RingtoetsDatabaseSourceFile(Location)) Index: Migration/Scripts/test/Migration.Scripts.Data.Test/CreateScriptTest.cs =================================================================== diff -u -r818656bda5265c4053d1d7a3bec2d0259080e2e0 -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Scripts/test/Migration.Scripts.Data.Test/CreateScriptTest.cs (.../CreateScriptTest.cs) (revision 818656bda5265c4053d1d7a3bec2d0259080e2e0) +++ Migration/Scripts/test/Migration.Scripts.Data.Test/CreateScriptTest.cs (.../CreateScriptTest.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -88,7 +88,7 @@ var createScript = new CreateScript(version, query); // Call - VersionedFile versionedFile = createScript.CreateEmptyVersionedFile(filePath); + IVersionedFile versionedFile = createScript.CreateEmptyVersionedFile(filePath); // Assert Assert.IsTrue(File.Exists(versionedFile.Location)); Index: Migration/Scripts/test/Migration.Scripts.Data.Test/MigrationScriptTest.cs =================================================================== diff -u -rf5120263f838eaf211d8f73ca08a78c22e9777fb -r07ab02003751f717e8534ff7392cb915efcdc3b8 --- Migration/Scripts/test/Migration.Scripts.Data.Test/MigrationScriptTest.cs (.../MigrationScriptTest.cs) (revision f5120263f838eaf211d8f73ca08a78c22e9777fb) +++ Migration/Scripts/test/Migration.Scripts.Data.Test/MigrationScriptTest.cs (.../MigrationScriptTest.cs) (revision 07ab02003751f717e8534ff7392cb915efcdc3b8) @@ -120,7 +120,7 @@ var versionedFile = new VersionedFile("c:\\file.ext"); // Call - VersionedFile upgradedFile = migrationScript.Upgrade(versionedFile); + IVersionedFile upgradedFile = migrationScript.Upgrade(versionedFile); // Assert Assert.IsNotNull(upgradedFile); @@ -138,7 +138,7 @@ var versionedFile = new VersionedFile("c:\\file.ext"); // Call - VersionedFile upgradedFile = migrationScript.Upgrade(versionedFile); + IVersionedFile upgradedFile = migrationScript.Upgrade(versionedFile); // Assert Assert.IsNotNull(upgradedFile);