From 2de3ff5fad8f82056f9617f95b30a570af1b5509 Mon Sep 17 00:00:00 2001 From: Vladyslav Danylov Date: Tue, 14 Jun 2016 15:09:11 +0300 Subject: [PATCH 01/13] [PAA-1241] Updated solution to VS2015. --- .../Assemblies/deltaRunner.dll | Bin 0 -> 45056 bytes .../Assemblies/nunit.framework.dll | Bin 0 -> 28672 bytes Backup/DataFresh.Common/AssemblyInfo.cs | 58 +++ Backup/DataFresh.Common/Build/buildPrefix.txt | 1 + Backup/DataFresh.Common/Build/default.build | 140 +++++++ .../DataFresh.Common/DataFresh.Common.csproj | 119 ++++++ .../DataFresh.Common/Database/PlaceHolder.txt | 0 .../Executables/PlaceHolder.txt | 0 Backup/DataFresh/AssemblyInfo.cs | 4 + Backup/DataFresh/DataFresh.csproj | 132 +++++++ Backup/DataFresh/DataFreshConsole.cs | 198 ++++++++++ Backup/DataFresh/IDataFresh.cs | 65 ++++ Backup/DataFresh/Readme.txt | 112 ++++++ Backup/DataFresh/ResourceManagement.cs | 148 ++++++++ .../DataFresh/Resources/PrepareDataFresh.sql | 280 ++++++++++++++ .../DataFresh/Resources/RemoveDataFresh.sql | 27 ++ Backup/DataFresh/SqlDataFresh.cs | 277 ++++++++++++++ Backup/DataFresh/SqlDataFreshException.cs | 30 ++ Backup/DataFreshUtil/App.ico | Bin 0 -> 1078 bytes Backup/DataFreshUtil/AssemblyInfo.cs | 5 + Backup/DataFreshUtil/DataFreshUtil.csproj | 109 ++++++ Backup/DataFreshUtil/EntryPoint.cs | 31 ++ Backup/EntropyZero DataFresh Solution.sln | 51 +++ Backup/TestHarnessExample/MoreSampleTests.cs | 342 ++++++++++++++++++ Backup/TestHarnessExample/Readme.txt | 11 + Backup/TestHarnessExample/SampleTests.cs | 46 +++ .../Scripts/Clean Database.bat | 3 + .../Scripts/Create Database.bat | 5 + .../Scripts/DataFresh Usage.bat | 2 + .../TestHarnessExample/Scripts/Database.sql | 196 ++++++++++ .../Scripts/Prepare Database.bat | 3 + .../Scripts/Refresh Database.bat | 3 + .../Scripts/Refresh Entire Database.bat | 3 + Backup/TestHarnessExample/TestFixtureBase.cs | 65 ++++ .../TestHarnessExample.csproj | 147 ++++++++ .../DataFreshConsoleTester.cs | 116 ++++++ .../Database Files/Database.sql | 67 ++++ .../Database Files/Deltas/PlaceHolder.txt | 0 .../Database Files/Setup.sql | 44 +++ .../Testing.DataFresh/SqlDataFreshTester.cs | 325 +++++++++++++++++ Backup/Testing.DataFresh/TestFixtureBase.cs | 56 +++ .../Testing.DataFresh.csproj | 132 +++++++ DataFresh.Common/DataFresh.Common.csproj | 215 +++++------ DataFresh/DataFresh.csproj | 240 ++++++------ DataFreshUtil/DataFreshUtil.csproj | 208 +++++------ EntropyZero DataFresh Solution.sln | 94 +++-- TestHarnessExample/TestHarnessExample.csproj | 260 ++++++------- Testing.DataFresh/Testing.DataFresh.csproj | 244 ++++++------- UpgradeLog.htm | Bin 0 -> 84806 bytes 49 files changed, 3924 insertions(+), 690 deletions(-) create mode 100644 Backup/DataFresh.Common/Assemblies/deltaRunner.dll create mode 100644 Backup/DataFresh.Common/Assemblies/nunit.framework.dll create mode 100644 Backup/DataFresh.Common/AssemblyInfo.cs create mode 100644 Backup/DataFresh.Common/Build/buildPrefix.txt create mode 100644 Backup/DataFresh.Common/Build/default.build create mode 100644 Backup/DataFresh.Common/DataFresh.Common.csproj create mode 100644 Backup/DataFresh.Common/Database/PlaceHolder.txt create mode 100644 Backup/DataFresh.Common/Executables/PlaceHolder.txt create mode 100644 Backup/DataFresh/AssemblyInfo.cs create mode 100644 Backup/DataFresh/DataFresh.csproj create mode 100644 Backup/DataFresh/DataFreshConsole.cs create mode 100644 Backup/DataFresh/IDataFresh.cs create mode 100644 Backup/DataFresh/Readme.txt create mode 100644 Backup/DataFresh/ResourceManagement.cs create mode 100644 Backup/DataFresh/Resources/PrepareDataFresh.sql create mode 100644 Backup/DataFresh/Resources/RemoveDataFresh.sql create mode 100644 Backup/DataFresh/SqlDataFresh.cs create mode 100644 Backup/DataFresh/SqlDataFreshException.cs create mode 100644 Backup/DataFreshUtil/App.ico create mode 100644 Backup/DataFreshUtil/AssemblyInfo.cs create mode 100644 Backup/DataFreshUtil/DataFreshUtil.csproj create mode 100644 Backup/DataFreshUtil/EntryPoint.cs create mode 100644 Backup/EntropyZero DataFresh Solution.sln create mode 100644 Backup/TestHarnessExample/MoreSampleTests.cs create mode 100644 Backup/TestHarnessExample/Readme.txt create mode 100644 Backup/TestHarnessExample/SampleTests.cs create mode 100644 Backup/TestHarnessExample/Scripts/Clean Database.bat create mode 100644 Backup/TestHarnessExample/Scripts/Create Database.bat create mode 100644 Backup/TestHarnessExample/Scripts/DataFresh Usage.bat create mode 100644 Backup/TestHarnessExample/Scripts/Database.sql create mode 100644 Backup/TestHarnessExample/Scripts/Prepare Database.bat create mode 100644 Backup/TestHarnessExample/Scripts/Refresh Database.bat create mode 100644 Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat create mode 100644 Backup/TestHarnessExample/TestFixtureBase.cs create mode 100644 Backup/TestHarnessExample/TestHarnessExample.csproj create mode 100644 Backup/Testing.DataFresh/DataFreshConsoleTester.cs create mode 100644 Backup/Testing.DataFresh/Database Files/Database.sql create mode 100644 Backup/Testing.DataFresh/Database Files/Deltas/PlaceHolder.txt create mode 100644 Backup/Testing.DataFresh/Database Files/Setup.sql create mode 100644 Backup/Testing.DataFresh/SqlDataFreshTester.cs create mode 100644 Backup/Testing.DataFresh/TestFixtureBase.cs create mode 100644 Backup/Testing.DataFresh/Testing.DataFresh.csproj create mode 100644 UpgradeLog.htm diff --git a/Backup/DataFresh.Common/Assemblies/deltaRunner.dll b/Backup/DataFresh.Common/Assemblies/deltaRunner.dll new file mode 100644 index 0000000000000000000000000000000000000000..749e99d7418096ef48982697592b4f4d688fc964 GIT binary patch literal 45056 zcmeHwd3+nywf~)wtldh+j^!*iQ5F)%Be}NaWn==xTM~!F3AVFAXwc?FU`vi9Ck`QC zO3Tth3$&%sLJM?FS7>RWlu{@=56Zrlq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;Im7^o!P~c6+Tz{cDj(57~4gIN@YmC|CI#ZE59BxawT|2m@*N^CZzaf4( n>7Qv!<1BuP2ow=0B2Yx2h(Hm6A_7GOiU<@DC?fE`1%dwyQUP;L literal 0 HcmV?d00001 diff --git a/Backup/DataFresh.Common/Assemblies/nunit.framework.dll b/Backup/DataFresh.Common/Assemblies/nunit.framework.dll new file mode 100644 index 0000000000000000000000000000000000000000..220a58a9e13bad5323617edf097dd34dd55eb3ac GIT binary patch literal 28672 zcmeHP3!Gb3ng7nYNhXudr0;1fQ<~C;p`8hxwjhs+opxF}^hu{JEp+XqGq=+~CK+y$ zwu2Sw1BA6AT`S6h@~R68y0D-YtcZ&8P*GO2zHmWYt;(+GB0p3f`~SXk@6AnS23d7~ zKYzQqZN7WH$N668JLjHrlXmraSCd6VA$(qamFO_;d@UCE+F&2p@oD$P>7M#;Oh2qv zePjBDotZ*nz{&SH>Hb7dI+x2A6Wi^CQ_3YWxkSg>u0(&n*G@Gy#%8*z*DWJjr7T)| ztf}3z_7ugZk5UoiM8Z%%x)pbBcjH4eR@!5X-%Mct<+>3N^bh}*I4+QZ;BWcvqD;cI z3VPRaqnl_QC!+e=N7PVFdp&r9C>oH90$&lpQ$>4E5%{4+0N_c&#ZR=|D*>-kPQmE` zF1~f6!7}Uc30#ZOJLTBfJOstpePFU&H$H)DG0~C$T5HxaP|H9q1GNm)GEmDvEd#X- z)G|=ZKrI8c4E#UJz&<`#uN6YZN#RL{h~wJrgA03WG&Y3$;Ae)!wpzH;B_ z1*Ky*&G_z-L#2zp^hDwGTQB>`jwL7jB>KXZhx57Lf9GG0yJ6|}DUY0%xb@N()T4(t zzxk@0fBl1S_u5aq;mZ$AzV5D-bNY{)tkb=9Ut4ii^owWy;=t{nKkeB5MC8=-!Yva~;>oMxxjp&@@eQX(B&qv&ie#IxCb+5~1Vxd6u6KZB0nxH36#=I<&~8FBuJe zLEZ>@TSnH4Hy$JEE%QS3cdpF}f0H=y$6Cke^+Wp=65f zXlqMy97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|nV=)2poDDvcIk@xrtLy=vHFB^~g!~T45PP;;PF)v* z)(hz@^d`l}Rp9lB299s^hSIgRl8~#sAZs*fm#M?8K`BT amVsIZY8j|ypq7DJ25K3oW#Ip22L2nBo6=zb literal 0 HcmV?d00001 diff --git a/Backup/DataFresh.Common/AssemblyInfo.cs b/Backup/DataFresh.Common/AssemblyInfo.cs new file mode 100644 index 0000000..9f89a32 --- /dev/null +++ b/Backup/DataFresh.Common/AssemblyInfo.cs @@ -0,0 +1,58 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +// +// 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("")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("")] +[assembly: AssemblyCopyright("")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// +[assembly: AssemblyDelaySign(false)] +[assembly: AssemblyKeyFile("")] +[assembly: AssemblyKeyName("")] diff --git a/Backup/DataFresh.Common/Build/buildPrefix.txt b/Backup/DataFresh.Common/Build/buildPrefix.txt new file mode 100644 index 0000000..2998829 --- /dev/null +++ b/Backup/DataFresh.Common/Build/buildPrefix.txt @@ -0,0 +1 @@ +1.1.0. diff --git a/Backup/DataFresh.Common/Build/default.build b/Backup/DataFresh.Common/Build/default.build new file mode 100644 index 0000000..9382f83 --- /dev/null +++ b/Backup/DataFresh.Common/Build/default.build @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + if exists (Select * from sysdatabases where name = '${DatabaseName}') + BEGIN + + ALTER DATABASE [${DatabaseName}] + SET SINGLE_USER + WITH ROLLBACK IMMEDIATE + + DROP DATABASE [${DatabaseName}] + END; + + + + + + CREATE DATABASE [${DatabaseName}] + ON ( + NAME = N'${DatabaseName}_Data' + , FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL\Data\${DatabaseName}_Data.MDF' + , FILEGROWTH = 10%) + LOG ON ( + NAME = N'${DatabaseName}_Log' + , FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL\Data\${DatabaseName}_log.LDF' + , FILEGROWTH = 10%) + COLLATE SQL_Latin1_General_CP1_CI_AS; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Backup/DataFresh.Common/DataFresh.Common.csproj b/Backup/DataFresh.Common/DataFresh.Common.csproj new file mode 100644 index 0000000..7f4e12d --- /dev/null +++ b/Backup/DataFresh.Common/DataFresh.Common.csproj @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Backup/DataFresh.Common/Database/PlaceHolder.txt b/Backup/DataFresh.Common/Database/PlaceHolder.txt new file mode 100644 index 0000000..e69de29 diff --git a/Backup/DataFresh.Common/Executables/PlaceHolder.txt b/Backup/DataFresh.Common/Executables/PlaceHolder.txt new file mode 100644 index 0000000..e69de29 diff --git a/Backup/DataFresh/AssemblyInfo.cs b/Backup/DataFresh/AssemblyInfo.cs new file mode 100644 index 0000000..6be57f4 --- /dev/null +++ b/Backup/DataFresh/AssemblyInfo.cs @@ -0,0 +1,4 @@ +using System.Reflection; +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyTitleAttribute("dataFresh")] +[assembly: DataFresh.AssemblyResourceEncrpytion(false)] diff --git a/Backup/DataFresh/DataFresh.csproj b/Backup/DataFresh/DataFresh.csproj new file mode 100644 index 0000000..5b817ee --- /dev/null +++ b/Backup/DataFresh/DataFresh.csproj @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Backup/DataFresh/DataFreshConsole.cs b/Backup/DataFresh/DataFreshConsole.cs new file mode 100644 index 0000000..6bc4fbd --- /dev/null +++ b/Backup/DataFresh/DataFreshConsole.cs @@ -0,0 +1,198 @@ +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +using System; +using System.Collections.Specialized; +using System.IO; +using System.Text; + +namespace DataFresh +{ + public class DataFreshConsole + { + private StringBuilder results = new StringBuilder(); + + public NameValueCollection arguments = new NameValueCollection(); + public string connectionString = string.Empty; + + public string Results + { + get { return results.ToString(); } + } + + public void Start(string[] args) + { + ConsoleWrite("DataFresh provided by Entropy Zero Consulting"); + + if (args == null || args.Length < 2) + { + WriteUsage(); + return; + } + + for (int i = 0; i < args.Length; i = i + 2) + { + this.arguments.Add(args[i].Replace("-", ""), args[i + 1]); + //ConsoleWrite(args[i] + ": " +args[i+1]); + } + + if (!CheckForRequiredArguments(this.arguments)) + { + return; + } + + connectionString = string.Format(@"user id={0};password={1};Initial Catalog={2};Data Source={3};", + this.arguments["u"], + this.arguments["p"], + this.arguments["d"], + this.arguments["s"]); + + SqlDataFresh dataFresh = new SqlDataFresh(connectionString, true); + + string snapshotPath = this.arguments["sp"]; + + if (snapshotPath != null) + { + snapshotPath = snapshotPath.Replace("\"", ""); + if (!snapshotPath.EndsWith(@"\")) + { + snapshotPath += @"\"; + } + + ConsoleWrite("snapshotPath = {0}", snapshotPath); + string fullPath = Path.GetFullPath(snapshotPath); + ConsoleWrite("fullPath = {0}", fullPath); + dataFresh.SnapshotPath = new DirectoryInfo(snapshotPath); + } + + string command = this.arguments["c"].ToUpper(); + switch (command) + { + case "PREPARE": + bool ignoreSnapshot = false; + string ignoreSnapshotArgument = arguments["ignoresnapshot"]; + if(ignoreSnapshotArgument != null) + { + if(ignoreSnapshotArgument == "1") + { + ignoreSnapshot = true; + } + } + dataFresh.PrepareDatabaseforDataFresh(!ignoreSnapshot); + break; + case "REFRESH": + dataFresh.RefreshTheDatabase(); + break; + case "FORCEREFRESH": + dataFresh.RefreshTheEntireDatabase(); + break; + case "REMOVE": + dataFresh.RemoveDataFreshFromDatabase(); + break; + case "SNAPSHOT": + dataFresh.CreateSnapshot(); + break; + case "FOO": + //no nothing + break; + default: + ConsoleWrite("Command '{0}' was not recognized", command); + break; + } + } + + private void ConsoleWrite(string message, params object[] args) + { + results.AppendFormat(message, args); + results.AppendFormat(Environment.NewLine); + + Console.Out.WriteLine(message, args); + } + + private bool CheckForRequiredArguments(NameValueCollection myArgs) + { + if ( + myArgs == null || + myArgs["c"] == null || + myArgs["s"] == null || + myArgs["d"] == null || + myArgs["u"] == null || + myArgs["p"] == null + ) + { + ConsoleWrite("Missing required arguments."); + WriteUsage(); + return false; + } + return true; + } + + private void WriteUsage() + { + string usageText = @" +Usage: + + DataFreshUtil.exe + -c Command + -s Server + -d Database + -u Username + -p Password [options] + +Options: + + -sp specify path on server where snapshot files are located + -ignoresnapshot 1: ignore snapshot during prepare + 0: (default) will create snapshot + +Commands: + + PREPARE prepare the database for DataFresh + REFRESH refresh the database + FORCEREFRESH refresh the database ignoring the change tracking table + REMOVE remove the DataFresh elements from the database + SNAPSHOT create a snapshot of your database +"; + + ConsoleWrite(usageText); + } + + public static DataFreshConsole Execute(string command, string username, string password, string server, string database, params string[] options) + { + string[] args = new string[] + { + "-c", command, + "-u", username, + "-p", password, + "-s", server, + "-d", database, + }; + + if (options != null && options.Length > 1) + { + string argsString = string.Join("|", args); + string optionsString = string.Join("|", options); + args = string.Format(argsString + "|" + optionsString).Split('|'); + } + + DataFreshConsole console = new DataFreshConsole(); + console.Start(args); + return console; + } + } +} \ No newline at end of file diff --git a/Backup/DataFresh/IDataFresh.cs b/Backup/DataFresh/IDataFresh.cs new file mode 100644 index 0000000..a030e17 --- /dev/null +++ b/Backup/DataFresh/IDataFresh.cs @@ -0,0 +1,65 @@ +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +using System.IO; + +namespace DataFresh +{ + public interface IDataFresh + { + /// + /// prepare the database to use the dataFresh library + /// + void PrepareDatabaseforDataFresh(); + + /// + /// refresh the database to a known state + /// + void RefreshTheDatabase(); + + /// + /// determine if the database has been modified + /// + /// true if modified + bool HasDatabaseBeenModified(); + + /// + /// remove the dataFresh objects from a database + /// + void RemoveDataFreshFromDatabase(); + + /// + /// refresh the database ignoring the dataFresh change tracking table. + /// + void RefreshTheEntireDatabase(); + + /// + /// create snapshot of database + /// + void CreateSnapshot(); + + /// + /// location on the server where the snapshot files are located + /// + DirectoryInfo SnapshotPath + { + get; + set; + } + } +} \ No newline at end of file diff --git a/Backup/DataFresh/Readme.txt b/Backup/DataFresh/Readme.txt new file mode 100644 index 0000000..e60b907 --- /dev/null +++ b/Backup/DataFresh/Readme.txt @@ -0,0 +1,112 @@ +dataFresh by EntropyZero Consulting + +Entropy's dataFresh is a toolkit that assists test driven development +projects in restoring their database to a known state before each test within +a test fixture. The time consuming effort of having to write tear down +methods to clean up the database after running your tests are a thing of the +past. + +Our appoach is unlike others as we do not attempt to rip and replace the +entire database. Instead we track database modifications to the table +level and only work with those tables that have been modified. + + +Preparing your database + +Before you can use dataFresh to refresh your data you will need to prepare +your database. Calling the PrepareDatabaseforDataFresh method will connect +to the specified database and will create the dataFresh elements required +to track and refresh your data. + +Example: + + string connectionString = ""; + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + dataFresh.PrepareDatabaseforDataFresh(); + + +Create Snapshot + +As part of the call to the PrepareDatabaseforDataFresh method, we create +a snapshot of your database that will be used to refresh the database. +Alternativly you may request that the call to prepare the database skip +the snapshot step, in which case you will want to need to to call the +CreateSnapshot method manually before you will be able to refresh the +database. You may also override the filepath where there snapshot +resides by setting the SnapshotPath property. + +Example: + + string connectionString = ""; + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + bool createSnapshot = false; + dataFresh.PrepareDatabaseforDataFresh(createSnapshot); + + +Specify the SnapshotPath + +You may tell dataFresh where you want to save the snapshot files of your +database by setting the SnapshotPath property of your dataFresh instance. +Please be aware that the location will be referenced by and therefore +should be accessible to the SQL server. + +Example: + + string connectionString = ""; + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + bool createSnapshot = false; + DirectoryInfo snapshotPath = + new DirectoryInfo("d:\Sql\Data\Snapshot_DatabaseName"); + dataFresh.PrepareDatabaseforDataFresh(createSnapshot); + + +HasDatabaseBeenModified Method + +This method will strangely enough return true if your database has been +modified since the last refresh command. + +Example: + + string connectionString = ""; + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + if(dataFresh.HasDatabaseBeenModified) + { + Console.Out("Database has been modified!"); + dataFresh.RefreshTheDatabase(); + } + + +RefreshTheDatabase Method + +When called, this method will clear out the modified tables and refresh +the database from the snapshot files. If you specified an alternate +location for your snapshot files, please be sure the the SnapshotPath +property has been set before calling this command. + + +RefreshTheEntireDatabase Method + +When called, this method will clear out and refresh all tables regardless +if they have been modified or not. Again, If you specified an alternate +location for your snapshot files, please be sure the the SnapshotPath +property has been set before calling this command. + + +RemoveDataFreshFromDatabase + +When you are ready to move into production, or no longer need the help of +dataFresh, simply call the RemoveDataFreshFromDatabase method and we will +gladly remove all the dataFresh elements from your database. :) + + +dataFresh on the Command Line + +You can integrate dataFresh into your automated builds by using the command +line version of dataFresh. Here are some examples of the concepts listed +above. + +DataFreshUtil.exe -s 127.0.0.1 -u -p -d DataFreshSample -c PREPARE + +DataFreshUtil.exe -s 127.0.0.1 -u -p -d DataFreshSample -c REFRESH + +DataFreshUtil.exe -s 127.0.0.1 -u -p -d DataFreshSample -c REMOVE diff --git a/Backup/DataFresh/ResourceManagement.cs b/Backup/DataFresh/ResourceManagement.cs new file mode 100644 index 0000000..d800bac --- /dev/null +++ b/Backup/DataFresh/ResourceManagement.cs @@ -0,0 +1,148 @@ +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +using System; +using System.IO; +using System.Reflection; +using System.Security.Cryptography; + +namespace DataFresh +{ + [AttributeUsage(AttributeTargets.Assembly)] + public class AssemblyResourceEncrpytion : Attribute + { + private bool enryptionEnabled; + private string enryptionKey = "nopassword"; + + public AssemblyResourceEncrpytion() + { + enryptionEnabled = true; + } + + public AssemblyResourceEncrpytion(bool enabled) + { + enryptionEnabled = enabled; + } + + public virtual bool Enabled + { + get + { + return enryptionEnabled; + } + set + { + enryptionEnabled = value; + } + } + + public virtual string Key + { + get + { + return enryptionKey; + } + } + } + + public class ResourceManagement + { + public static bool EncryptionEnabled + { + get + { + object[] customAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyResourceEncrpytion), false); + if(customAttributes != null && customAttributes.Length > 0) + { + AssemblyResourceEncrpytion enc = (AssemblyResourceEncrpytion) customAttributes[0]; + return enc.Enabled; + } + return false; + } + } + + public static string EncryptionKey + { + get + { + object[] customAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyResourceEncrpytion), false); + if(customAttributes != null && customAttributes.Length > 0) + { + AssemblyResourceEncrpytion enc = (AssemblyResourceEncrpytion) customAttributes[0]; + return enc.Key; + } + throw new Exception("Encryption key was not set!"); + } + } + + public static string GetDecryptedResource(string name) + { + byte[] dec = GetDecryptedResourceBytes(name); + string decStr = new MemoryStream(dec).ToString(); + return decStr; + } + + public static StreamReader GetDecryptedResourceStream(string name) + { + StreamReader reader = new StreamReader(new MemoryStream(GetDecryptedResourceBytes(name))); + return reader; + } + + public static byte[] GetDecryptedResourceBytes(string name) + { + Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name); + int length = (int)stream.Length; + byte[] bytes = new byte[length]; + stream.Read(bytes, 0, length); + if(EncryptionEnabled) + { + return Decrypt(bytes, EncryptionKey); + } + else + { + return bytes; + } + } + + public static byte[] Decrypt(byte[] cipherData, byte[] Key, byte[] IV) + { + MemoryStream ms = new MemoryStream(); + Rijndael alg = Rijndael.Create(); + alg.Key = Key; + alg.IV = IV; + CryptoStream cs = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write); + cs.Write(cipherData, 0, cipherData.Length); + cs.Flush(); + cs.Close(); + byte[] decryptedData = ms.ToArray(); + return decryptedData; + } + + public static byte[] Decrypt(byte[] cipherData, string Password) + { + PasswordDeriveBytes pdb = new PasswordDeriveBytes(Password, + new byte[] + { + 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, + 0x65, 0x76 + }); + + return Decrypt(cipherData, pdb.GetBytes(32), pdb.GetBytes(16)); + } + } +} diff --git a/Backup/DataFresh/Resources/PrepareDataFresh.sql b/Backup/DataFresh/Resources/PrepareDataFresh.sql new file mode 100644 index 0000000..9c49153 --- /dev/null +++ b/Backup/DataFresh/Resources/PrepareDataFresh.sql @@ -0,0 +1,280 @@ +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangedTableDataRefresh]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_ChangedTableDataRefresh] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerCreate]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerCreate] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerRemove] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataExtract]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_TableDataExtract] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataImport]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_TableDataImport] +GO + +IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) + CREATE TABLE [dbo].[df_ChangeTracking] + ( + [TABLENAME] sysname + ) +GO + +CREATE PROCEDURE dbo.[df_ChangedTableDataRefresh] +( + @BasePath NVARCHAR(512) +) +AS + + DECLARE @sql NVARCHAR(4000) + DECLARE @TableName VARCHAR(255) + + SELECT DISTINCT TableName INTO #ChangedTables FROM df_ChangeTracking + + TRUNCATE TABLE df_ChangeTracking + + DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR + SELECT [tablename] from #ChangedTables + UNION + SELECT DISTINCT + OBJECT_NAME(fkeyid) AS Referenced_Table + FROM + sysreferences sr + INNER JOIN #ChangedTables ct ON sr.rkeyid = OBJECT_ID(ct.tablename) + + OPEN Table_Cursor + + -- Deactivate Constrains for tables referencing changed tables + FETCH NEXT FROM Table_Cursor INTO @TableName + + WHILE (@@Fetch_Status = 0) + BEGIN + SET @sql = N'Alter Table [' + @TableName + '] NOCHECK CONSTRAINT ALL' + EXEC sp_executesql @sql + + FETCH NEXT FROM Table_Cursor INTO @TableName + END + + -- Delete All data from Changed Tables and Refill + DECLARE ChangedTable_Cursor CURSOR FOR + SELECT [tablename] FROM #ChangedTables WHERE tablename not in('df_ChangeTracking', 'dr_DeltaVersion') + + OPEN ChangedTable_Cursor + FETCH NEXT FROM ChangedTable_Cursor INTO @TableName + WHILE (@@Fetch_Status = 0) + BEGIN + PRINT @TableName + SET @sql = N'DELETE [' + @TableName + ']; DELETE df_ChangeTracking WHERE TableName=''' + @TableName + '''' + EXEC sp_executesql @sql + + SET @sql = N'IF(SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_name = ''' + @TableName + ''' AND IDENT_SEED(TABLE_NAME) IS NOT NULL) > 0 + BEGIN + DBCC CHECKIDENT ([' + @TableName + '], RESEED, 0) + END' + + EXEC sp_executesql @sql + + + SET @sql = N'BULK INSERT [' + @TableName + '] + FROM ''' + @BasePath + @TableName + '.df'' + WITH + ( + KEEPIDENTITY, + KEEPNULLS, + DATAFILETYPE=''native'' + )' + EXEC sp_executesql @sql + + FETCH NEXT FROM ChangedTable_Cursor INTO @TableName + END + CLOSE ChangedTable_Cursor + DEALLOCATE ChangedTable_Cursor + + -- ReEnable Constrants for All Tables + FETCH FIRST FROM Table_Cursor INTO @TableName + WHILE (@@Fetch_Status = 0) + BEGIN + SET @sql = N'Alter Table [' + @TableName + '] CHECK CONSTRAINT ALL' + EXEC sp_executesql @sql + + FETCH NEXT FROM Table_Cursor INTO @TableName + END + CLOSE Table_Cursor + DEALLOCATE Table_Cursor +GO + + +CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerCreate] +AS + + IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) + CREATE TABLE [df_ChangeTracking] + ( + [TABLENAME] sysname + ) + + DECLARE @sql NVARCHAR(4000) + DECLARE @TableName VARCHAR(255) + + DECLARE Table_Cursor CURSOR FOR + SELECT [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' + + OPEN Table_Cursor + FETCH NEXT FROM Table_Cursor INTO @TableName + + WHILE (@@Fetch_Status = 0) + BEGIN + SET @sql = N'IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE ID = Object_ID(N''[dbo].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) + DROP TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + ']' + EXEC sp_executesql @sql + + SET @sql = N'CREATE TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + '] on [' + @TableName + '] for insert, update, delete + as + SET NOCOUNT ON + INSERT INTO df_ChangeTracking (tablename) VALUES (''' + @TableName + ''') + SET NOCOUNT OFF' + + EXEC sp_executesql @sql + + FETCH NEXT FROM Table_Cursor INTO @TableName + + END + CLOSE Table_Cursor + DEALLOCATE Table_Cursor + +GO + +CREATE PROCEDURE dbo.[df_TableDataExtract] +( + @BasePath NVARCHAR(512) +) +AS + + DECLARE @MkDirCmd NVARCHAR(4000) + + SET @MkDirCmd = N'MKDIR "' + @BASEPATH + '"' + EXEC master.dbo.xp_cmdshell @MkDirCmd, no_output + + DECLARE @CMD NVARCHAR(4000) + + DECLARE Table_Cursor CURSOR FOR + SELECT N'bcp "' + DB_NAME() + '.dbo.[' + Table_Name + ']" out "' + @BasePath + Table_Name + '.df" -n -k -E -C 1252 -S ' + @@ServerName + ' -T' FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' + + OPEN Table_Cursor + FETCH NEXT FROM Table_Cursor INTO @CMD + + WHILE (@@Fetch_Status = 0) + BEGIN + EXEC master.dbo.xp_cmdshell @CMD, no_output + FETCH NEXT FROM Table_Cursor INTO @CMD + END + + CLOSE Table_Cursor + Deallocate Table_Cursor + +GO + +CREATE PROCEDURE dbo.[df_TableDataImport] +( + @BasePath NVARCHAR(512) +) +AS + + DECLARE @sql NVARCHAR(4000) + DECLARE @TableName VARCHAR(255) + + SELECT Table_Name as TableName INTO #UserTables FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' + + DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR + SELECT [tablename] FROM #UserTables + + OPEN Table_Cursor + + -- Deactivate Constrains for tables referencing changed tables + FETCH NEXT FROM Table_Cursor INTO @TableName + + WHILE (@@Fetch_Status = 0) + BEGIN + SET @sql = N'Alter Table [' + @TableName + '] NOCHECK CONSTRAINT ALL' + EXEC sp_executesql @sql + + FETCH NEXT FROM Table_Cursor INTO @TableName + END + + -- Delete All data from Changed Tables and Refill + DECLARE UserTable_Cursor CURSOR FOR + SELECT [tablename] FROM #UserTables WHERE tablename not in ('df_ChangeTracking', 'dr_DeltaVersion') + + OPEN UserTable_Cursor + + FETCH NEXT FROM UserTable_Cursor INTO @TableName + WHILE (@@Fetch_Status = 0) + BEGIN + PRINT @TableName + SET @sql = N'DELETE [' + @TableName + ']' + EXEC sp_executesql @sql + + SET @sql = N'BULK INSERT [' + @TableName + '] + FROM ''' + @BasePath + @TableName + '.df'' + WITH + ( + KEEPIDENTITY, + KEEPNULLS, + DATAFILETYPE=''native'' + )' + EXEC sp_executesql @sql + + FETCH NEXT FROM UserTable_Cursor INTO @TableName + + END + CLOSE UserTable_Cursor + DEALLOCATE UserTable_Cursor + + -- ReEnable Constrants for All Tables + FETCH FIRST FROM Table_Cursor INTO @TableName + WHILE (@@Fetch_Status = 0) + BEGIN + SET @sql = N'Alter Table [' + @TableName + '] CHECK CONSTRAINT ALL' + EXEC sp_executesql @sql + + FETCH NEXT FROM Table_Cursor INTO @TableName + END + + CLOSE Table_Cursor + DEALLOCATE Table_Cursor + +GO + +CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerRemove] +AS + DECLARE @sql NVARCHAR(4000) + DECLARE @TableName VARCHAR(255) + + DECLARE Table_Cursor CURSOR FOR + SELECT [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' + + OPEN Table_Cursor + FETCH NEXT FROM Table_Cursor INTO @TableName + + WHILE (@@Fetch_Status = 0) + BEGIN + SET @sql = N'IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = Object_ID(N''[dbo].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) + DROP TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + ']' + + EXEC sp_executesql @sql + + FETCH NEXT FROM Table_Cursor INTO @TableName + + END + CLOSE Table_Cursor + DEALLOCATE Table_Cursor + + IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) + DROP TABLE [dbo].[df_ChangeTracking] + +GO \ No newline at end of file diff --git a/Backup/DataFresh/Resources/RemoveDataFresh.sql b/Backup/DataFresh/Resources/RemoveDataFresh.sql new file mode 100644 index 0000000..bf75522 --- /dev/null +++ b/Backup/DataFresh/Resources/RemoveDataFresh.sql @@ -0,0 +1,27 @@ +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + EXEC df_ChangeTrackingTriggerRemove +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangedTableDataRefresh]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_ChangedTableDataRefresh] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerCreate]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerCreate] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerRemove] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataExtract]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_TableDataExtract] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataImport]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) + DROP PROCEDURE [dbo].[df_TableDataImport] +GO + +IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTracking]') AND OBJECTPROPERTY(ID, N'IsTable') = 1) + DROP TABLE [dbo].[df_ChangeTracking] +GO \ No newline at end of file diff --git a/Backup/DataFresh/SqlDataFresh.cs b/Backup/DataFresh/SqlDataFresh.cs new file mode 100644 index 0000000..930aeee --- /dev/null +++ b/Backup/DataFresh/SqlDataFresh.cs @@ -0,0 +1,277 @@ +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +using System; +using System.Data.SqlClient; +using System.IO; +using System.Text; + +namespace DataFresh +{ + /// + /// dataFresh by Entropy Zero Consulting is a library that will enable + /// the test driven developer to build a test harness that will refresh + /// the database to a known state between tests + /// + public class SqlDataFresh : IDataFresh + { + #region Member Variables + + private string connectionString = null; + private DirectoryInfo snapshotPath = null; + + private string PrepareScriptResourceName = "DataFresh.Resources.PrepareDataFresh.sql"; + private string RemoveScriptResourceName = "DataFresh.Resources.RemoveDataFresh.sql"; + + public string PrepareProcedureName = "df_ChangeTrackingTriggerCreate"; + public string RefreshProcedureName = "df_ChangedTableDataRefresh"; + public string ExtractProcedureName = "df_TableDataExtract"; + public string ImportProcedureName = "df_TableDataImport"; + public string ChangeTrackingTableName = "df_ChangeTracking"; + + private bool verbose = false; + + #endregion + + #region Public Methods + + public SqlDataFresh(string connectionString) + { + this.connectionString = connectionString; + } + + public SqlDataFresh(string connectionString, bool verbose) + { + this.connectionString = connectionString; + this.verbose = verbose; + } + + public bool TableExists(string tableName) + { + int tableCount = Int32.Parse(ExecuteScalar(string.Format("SELECT COUNT(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='{0}'", tableName)).ToString()); + return (tableCount > 0); + } + + public bool ProcedureExists(string procedureName) + { + int procedureCount = Int32.Parse(ExecuteScalar(string.Format("SELECT COUNT(ROUTINE_NAME) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='{0}'", procedureName)).ToString()); + return (procedureCount > 0); + } + + #endregion + + #region IDataFresh Members + + /// + /// prepare the database to use the dataFresh library + /// + public void PrepareDatabaseforDataFresh() + { + PrepareDatabaseforDataFresh(true); + } + + public void PrepareDatabaseforDataFresh(bool createSnapshot) + { + DateTime before = DateTime.Now; + ConsoleWrite("PrepareDatabaseforDataFresh Started"); + RunSqlScript(ResourceManagement.GetDecryptedResourceStream(PrepareScriptResourceName)); + + ExecuteNonQuery("exec " + PrepareProcedureName); + + if(createSnapshot) + { + CreateSnapshot(); + } + ConsoleWrite("PrepareDatabaseforDataFresh Complete : " + (DateTime.Now - before)); + } + + /// + /// remove the dataFresh objects from a database + /// + public void RemoveDataFreshFromDatabase() + { + DateTime before = DateTime.Now; + ConsoleWrite("RemoveDataFreshFromDatabase Started"); + RunSqlScript(ResourceManagement.GetDecryptedResourceStream(RemoveScriptResourceName)); + ConsoleWrite("RemoveDataFreshFromDatabase Complete : " + (DateTime.Now - before)); + } + + /// + /// refresh the database to a known state + /// + public void RefreshTheDatabase() + { + DateTime before = DateTime.Now; + ConsoleWrite("RefreshTheDatabase Started"); + if (!ProcedureExists(RefreshProcedureName)) + { + throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); + } + ExecuteNonQuery(string.Format("exec {0} '{1}'", RefreshProcedureName, SnapshotPath.FullName)); + ConsoleWrite("RefreshTheDatabase Complete : " + (DateTime.Now - before)); + } + + /// + /// refresh the database ignoring the dataFresh change tracking table. + /// + public void RefreshTheEntireDatabase() + { + DateTime before = DateTime.Now; + ConsoleWrite("RefreshTheEntireDatabase Started"); + if (!ProcedureExists(ImportProcedureName)) + { + throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); + } + ExecuteNonQuery(string.Format("exec {0} '{1}'", ImportProcedureName, SnapshotPath.FullName)); + ConsoleWrite("RefreshTheEntireDatabase Complete : " + (DateTime.Now - before)); + } + + /// + /// create snapshot of database + /// + public void CreateSnapshot() + { + DateTime before = DateTime.Now; + ConsoleWrite("CreateSnapshot Started"); + if (!ProcedureExists(ExtractProcedureName)) + { + throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); + } + ExecuteNonQuery(string.Format("exec {0} '{1}'", ExtractProcedureName, SnapshotPath.FullName)); + ConsoleWrite("CreateSnapshot Complete : " + (DateTime.Now - before)); + } + + /// + /// determine if the database has been modified + /// + /// true if modified. + public bool HasDatabaseBeenModified() + { + if (!TableExists(ChangeTrackingTableName)) + { + throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); + } + + string sql = string.Format(@"SELECT COUNT(*) FROM {0} WHERE TableName <> '{0}'", ChangeTrackingTableName); + int ret = Convert.ToInt32(ExecuteScalar(sql)); + return ret > 0; + } + + /// + /// location on the server where the snapshot files are located + /// + public DirectoryInfo SnapshotPath + { + get + { + if (snapshotPath == null) + { + return GetSnapshopPath(); + } + return snapshotPath; + } + set + { + snapshotPath = CheckForIllegalCharsAndAppendTrailingSlash(value); + } + } + + #endregion + + #region Private Methods + + private static DirectoryInfo CheckForIllegalCharsAndAppendTrailingSlash(DirectoryInfo value) + { + if(value == null) + { + return null; + } + string path = value.FullName; + path = path.Replace("\"", ""); + if(!path.EndsWith(@"\")) + { + path += @"\"; + } + return new DirectoryInfo(path); + } + + private object ExecuteScalar(string sql) + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + sql = sql + " --dataProfilerIgnore"; + SqlCommand cmd = new SqlCommand(sql, conn); + cmd.CommandTimeout = 1200; + conn.Open(); + return cmd.ExecuteScalar(); + } + } + + private void ExecuteNonQuery(string sql) + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + sql = sql + " --dataProfilerIgnore"; + SqlCommand cmd = new SqlCommand(sql, conn); + cmd.CommandTimeout = 1200; + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + + private DirectoryInfo GetSnapshopPath() + { + string dbName = (string) ExecuteScalar("SELECT DB_Name()"); + string mdfFilePath = Path.GetDirectoryName(ExecuteScalar("select filename from sysfiles where filename like '%.MDF%'").ToString().Trim()); + return new DirectoryInfo(string.Format(@"{0}\Snapshot_{1}\", mdfFilePath, dbName)); + } + + private void RunSqlScript(StreamReader reader) + { + string line = ""; + StringBuilder cmd = new StringBuilder(); + while ((line = reader.ReadLine()) != null) + { + if (line.Trim().ToLower().Equals("go")) + { + ExecuteNonQuery(cmd.ToString()); + cmd.Length = 0; + } + else + { + cmd.Append(line); + cmd.Append(Environment.NewLine); + } + } + if (cmd.ToString().Trim().Length > 0) + { + ExecuteNonQuery(cmd.ToString()); + } + } + + private void ConsoleWrite(string message) + { + if(this.verbose) + { + Console.Out.WriteLine(message); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Backup/DataFresh/SqlDataFreshException.cs b/Backup/DataFresh/SqlDataFreshException.cs new file mode 100644 index 0000000..29afec1 --- /dev/null +++ b/Backup/DataFresh/SqlDataFreshException.cs @@ -0,0 +1,30 @@ +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +using System; + +namespace DataFresh +{ + public class SqlDataFreshException : ApplicationException + { + public SqlDataFreshException(string message) : base(message) + { + + } + } +} diff --git a/Backup/DataFreshUtil/App.ico b/Backup/DataFreshUtil/App.ico new file mode 100644 index 0000000000000000000000000000000000000000..3a5525fd794f7a7c5c8e6187f470ea3af38cd2b6 GIT binary patch literal 1078 zcmeHHJr05}7=1t!Hp3A*8IHkVf+j?-!eHY14Gtcw1Eb*_9>Bq^zETJ@GKj{_2j4$w zo9}xCh!8{T3=X##Skq>ikMjsvB|y%crWBM2iW(4pI}c%z6%lW!=~4v77#3{z!dmB1 z__&l)-{KUYR+|8|;wB^R|9ET$J@(@=#rd^=)qs85?vAy(PSF5CyNkus435LVkZ$rj zNw|JG-P7^hF<(;#o*Vk}5R#e|^13tBbQkeF?djULtvqyxd3<{9 literal 0 HcmV?d00001 diff --git a/Backup/DataFreshUtil/AssemblyInfo.cs b/Backup/DataFreshUtil/AssemblyInfo.cs new file mode 100644 index 0000000..700e112 --- /dev/null +++ b/Backup/DataFreshUtil/AssemblyInfo.cs @@ -0,0 +1,5 @@ +using System.Reflection; + +[assembly: AssemblyVersionAttribute("1.0.0.0")] +[assembly: AssemblyTitleAttribute("dataFresh Console Utility")] + diff --git a/Backup/DataFreshUtil/DataFreshUtil.csproj b/Backup/DataFreshUtil/DataFreshUtil.csproj new file mode 100644 index 0000000..7b6e37b --- /dev/null +++ b/Backup/DataFreshUtil/DataFreshUtil.csproj @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Backup/DataFreshUtil/EntryPoint.cs b/Backup/DataFreshUtil/EntryPoint.cs new file mode 100644 index 0000000..3abcf8c --- /dev/null +++ b/Backup/DataFreshUtil/EntryPoint.cs @@ -0,0 +1,31 @@ +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +using DataFresh; + +namespace DataFreshUtil +{ + public class EntryPoint + { + public static void Main(string[] args) + { + DataFreshConsole console = new DataFreshConsole(); + console.Start(args); + } + } +} \ No newline at end of file diff --git a/Backup/EntropyZero DataFresh Solution.sln b/Backup/EntropyZero DataFresh Solution.sln new file mode 100644 index 0000000..8a9727a --- /dev/null +++ b/Backup/EntropyZero DataFresh Solution.sln @@ -0,0 +1,51 @@ +Microsoft Visual Studio Solution File, Format Version 8.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh", "DataFresh\DataFresh.csproj", "{05438358-2120-4D97-974E-ACF80F7EA6F7}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHarnessExample", "TestHarnessExample\TestHarnessExample.csproj", "{D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing.DataFresh", "Testing.DataFresh\Testing.DataFresh.csproj", "{3E910EED-904F-4A52-A611-9278B682EFD3}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFreshUtil", "DataFreshUtil\DataFreshUtil.csproj", "{D1044AB1-AB58-42E3-A37B-4099116982A5}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh.Common", "DataFresh.Common\DataFresh.Common.csproj", "{0BAA8852-1597-43BB-AF78-BABA707D4D86}" + ProjectSection(ProjectDependencies) = postProject + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfiguration) = preSolution + Debug = Debug + Release = Release + EndGlobalSection + GlobalSection(ProjectConfiguration) = postSolution + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug.ActiveCfg = Debug|.NET + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug.Build.0 = Debug|.NET + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release.ActiveCfg = Release|.NET + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release.Build.0 = Release|.NET + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug.ActiveCfg = Debug|.NET + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug.Build.0 = Debug|.NET + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release.ActiveCfg = Release|.NET + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release.Build.0 = Release|.NET + {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug.ActiveCfg = Debug|.NET + {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug.Build.0 = Debug|.NET + {3E910EED-904F-4A52-A611-9278B682EFD3}.Release.ActiveCfg = Release|.NET + {3E910EED-904F-4A52-A611-9278B682EFD3}.Release.Build.0 = Release|.NET + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug.ActiveCfg = Debug|.NET + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug.Build.0 = Debug|.NET + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release.ActiveCfg = Release|.NET + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release.Build.0 = Release|.NET + {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Debug.ActiveCfg = Debug|.NET + {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Release.ActiveCfg = Release|.NET + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + EndGlobalSection + GlobalSection(ExtensibilityAddIns) = postSolution + EndGlobalSection +EndGlobal diff --git a/Backup/TestHarnessExample/MoreSampleTests.cs b/Backup/TestHarnessExample/MoreSampleTests.cs new file mode 100644 index 0000000..c87ea22 --- /dev/null +++ b/Backup/TestHarnessExample/MoreSampleTests.cs @@ -0,0 +1,342 @@ +using System; +using NUnit.Framework; + +namespace TestHarnessExample +{ + [TestFixture] + public class MoreSampleTests : TestFixtureBase + { + [Test] + public void SampleDatabaseWriteTest1() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest2() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest3() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest4() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest5() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest6() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest7() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest8() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest9() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest10() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest11() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest12() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest13() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest14() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest15() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest16() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest17() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest18() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest19() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest20() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest21() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest22() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest23() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest24() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest25() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest26() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest27() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest28() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest29() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest30() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest31() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest32() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + + [Test] + public void SampleDatabaseWriteTest33() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest34() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest35() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest36() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + } +} \ No newline at end of file diff --git a/Backup/TestHarnessExample/Readme.txt b/Backup/TestHarnessExample/Readme.txt new file mode 100644 index 0000000..708e823 --- /dev/null +++ b/Backup/TestHarnessExample/Readme.txt @@ -0,0 +1,11 @@ +Using the dataFresh Sample + +1. Copy the files from the Scripts folder to a folder on your desktop. + +2. Copy and DataFreshUtil.exe to the same folder on your desktop. + +3. Create a database on your local sql server instance names DataFreshSample + +4. Modify the appropriate authentication arguments to login to your sql server. + +5. Execute "Create Database.bat" -- This will populate the DataFreshSample database and prepare it by adding the DataFresh elements. \ No newline at end of file diff --git a/Backup/TestHarnessExample/SampleTests.cs b/Backup/TestHarnessExample/SampleTests.cs new file mode 100644 index 0000000..1b61c6d --- /dev/null +++ b/Backup/TestHarnessExample/SampleTests.cs @@ -0,0 +1,46 @@ +using System; +using NUnit.Framework; + +namespace TestHarnessExample +{ + [TestFixture] + public class SampleTests : TestFixtureBase + { + [Test] + public void SampleDatabaseWriteTest() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseWriteTest2() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + } + + [Test] + public void SampleDatabaseWriteTest3() + { + Console.Out.WriteLine("Test"); + Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); + Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); + Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); + Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); + } + + [Test] + public void SampleDatabaseReadTest() + { + Console.Out.WriteLine("Test"); + ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); + } + } +} \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Clean Database.bat b/Backup/TestHarnessExample/Scripts/Clean Database.bat new file mode 100644 index 0000000..42bebd1 --- /dev/null +++ b/Backup/TestHarnessExample/Scripts/Clean Database.bat @@ -0,0 +1,3 @@ +DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c REMOVE + +pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Create Database.bat b/Backup/TestHarnessExample/Scripts/Create Database.bat new file mode 100644 index 0000000..152f83c --- /dev/null +++ b/Backup/TestHarnessExample/Scripts/Create Database.bat @@ -0,0 +1,5 @@ +osql.exe -S 127.0.0.1 -U test -P test -d DataFreshSample -i database.sql + +DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c PREPARE + +pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/DataFresh Usage.bat b/Backup/TestHarnessExample/Scripts/DataFresh Usage.bat new file mode 100644 index 0000000..94f05ca --- /dev/null +++ b/Backup/TestHarnessExample/Scripts/DataFresh Usage.bat @@ -0,0 +1,2 @@ +DataFreshUtil.exe +pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Database.sql b/Backup/TestHarnessExample/Scripts/Database.sql new file mode 100644 index 0000000..618b1cf --- /dev/null +++ b/Backup/TestHarnessExample/Scripts/Database.sql @@ -0,0 +1,196 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Book]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Book] +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Author]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Author] +GO + +CREATE TABLE [Author] +( + [AuthorId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY + , [Lastname] VARCHAR(55) NOT NULL + , [Firstname] VARCHAR(25) NOT NULL +) +GO + +CREATE TABLE [Book] +( + [BookId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY + , [AuthorId] INT NOT NULL CONSTRAINT fk_Book_Author_AuthorId FOREIGN KEY ([AuthorId]) REFERENCES [Author]([AuthorId]) + , [Title] VARCHAR(55) NOT NULL +) +GO + +PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Author' +SET IDENTITY_INSERT [dbo].[Author] ON +INSERT INTO [Author] + ( + [AuthorId] + , [Lastname] + , [Firstname] + ) + SELECT 1, 'Brockey', 'Michael' UNION + SELECT 2, 'Buxton', 'Stevem' UNION + SELECT 3, 'Jones', 'Happy' UNION + SELECT 4, 'Smith', 'john' UNION + SELECT 5, 'Johnson', 'Todd' UNION + SELECT 6, 'Brockey', 'Michael' UNION + SELECT 7, 'Buxton', 'Stevem' UNION + SELECT 8, 'Jones', 'Happy' UNION + SELECT 9, 'Smith', 'john' UNION + SELECT 10, 'Johnson', 'Todd' UNION + SELECT 11, 'Brockey', 'Michael' UNION + SELECT 12, 'Buxton', 'Stevem' UNION + SELECT 13, 'Jones', 'Happy' UNION + SELECT 14, 'Smith', 'john' UNION + SELECT 15, 'Johnson', 'Todd' UNION + SELECT 16, 'Brockey', 'Michael' UNION + SELECT 17, 'Buxton', 'Stevem' UNION + SELECT 18, 'Jones', 'Happy' UNION + SELECT 19, 'Smith', 'john' UNION + SELECT 20, 'Johnson', 'Todd' UNION + SELECT 21, 'Brockey', 'Michael' UNION + SELECT 22, 'Buxton', 'Stevem' UNION + SELECT 23, 'Jones', 'Happy' UNION + SELECT 24, 'Smith', 'john' UNION + SELECT 25, 'Johnson', 'Todd' UNION + SELECT 26, 'Brockey', 'Michael' UNION + SELECT 27, 'Buxton', 'Stevem' UNION + SELECT 28, 'Jones', 'Happy' UNION + SELECT 29, 'Smith', 'john' UNION + SELECT 30, 'Johnson', 'Todd' UNION + SELECT 31, 'Brockey', 'Michael' UNION + SELECT 32, 'Buxton', 'Stevem' UNION + SELECT 33, 'Jones', 'Happy' UNION + SELECT 34, 'Smith', 'john' UNION + SELECT 35, 'Johnson', 'Todd' UNION + SELECT 36, 'Brockey', 'Michael' UNION + SELECT 37, 'Buxton', 'Stevem' UNION + SELECT 38, 'Jones', 'Happy' UNION + SELECT 39, 'Smith', 'john' UNION + SELECT 40, 'Johnson', 'Todd' UNION + SELECT 41, 'Brockey', 'Michael' UNION + SELECT 42, 'Buxton', 'Stevem' UNION + SELECT 43, 'Jones', 'Happy' UNION + SELECT 44, 'Smith', 'john' UNION + SELECT 45, 'Johnson', 'Todd' UNION + SELECT 46, 'Brockey', 'Michael' UNION + SELECT 47, 'Buxton', 'Stevem' UNION + SELECT 48, 'Jones', 'Happy' UNION + SELECT 49, 'Smith', 'john' UNION + SELECT 50, 'Johnson', 'Todd' +SET IDENTITY_INSERT [dbo].[Author] OFF +GO + +PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Book' +SET IDENTITY_INSERT [dbo].[Book] ON +INSERT INTO [Book] + ( + [BookId] + , [AuthorId] + , [Title] + ) + SELECT 1, 1, 'My First Book' UNION + SELECT 2, 1, 'My Second Book' UNION + SELECT 3, 2, 'My First Book' UNION + SELECT 4, 2, 'My Second Book' UNION + SELECT 5, 3, 'My First Book' UNION + SELECT 6, 4, 'My First Book' UNION + SELECT 7, 5, 'My First Book' UNION + SELECT 8, 2, 'My Second Book' UNION + SELECT 9, 3, 'My First Book' UNION + SELECT 10, 4, 'My First Book' UNION + SELECT 11, 1, 'My First Book' UNION + SELECT 12, 1, 'My Second Book' UNION + SELECT 13, 2, 'My First Book' UNION + SELECT 14, 2, 'My Second Book' UNION + SELECT 15, 3, 'My First Book' UNION + SELECT 16, 4, 'My First Book' UNION + SELECT 17, 5, 'My First Book' UNION + SELECT 18, 2, 'My Second Book' UNION + SELECT 19, 3, 'My First Book' UNION + SELECT 20, 4, 'My First Book' UNION + SELECT 21, 1, 'My First Book' UNION + SELECT 22, 1, 'My Second Book' UNION + SELECT 23, 2, 'My First Book' UNION + SELECT 24, 2, 'My Second Book' UNION + SELECT 25, 3, 'My First Book' UNION + SELECT 26, 4, 'My First Book' UNION + SELECT 27, 5, 'My First Book' UNION + SELECT 28, 2, 'My Second Book' UNION + SELECT 29, 3, 'My First Book' UNION + SELECT 30, 4, 'My First Book' UNION + SELECT 31, 1, 'My First Book' UNION + SELECT 32, 1, 'My Second Book' UNION + SELECT 33, 2, 'My First Book' UNION + SELECT 34, 2, 'My Second Book' UNION + SELECT 35, 3, 'My First Book' UNION + SELECT 36, 4, 'My First Book' UNION + SELECT 37, 5, 'My First Book' UNION + SELECT 38, 2, 'My Second Book' UNION + SELECT 39, 3, 'My First Book' UNION + SELECT 40, 4, 'My First Book' UNION + SELECT 41, 1, 'My First Book' UNION + SELECT 42, 1, 'My Second Book' UNION + SELECT 43, 2, 'My First Book' UNION + SELECT 44, 2, 'My Second Book' UNION + SELECT 45, 3, 'My First Book' UNION + SELECT 46, 4, 'My First Book' UNION + SELECT 47, 5, 'My First Book' UNION + SELECT 48, 2, 'My Second Book' UNION + SELECT 49, 3, 'My First Book' UNION + SELECT 50, 4, 'My First Book' UNION + SELECT 51, 1, 'My First Book' UNION + SELECT 52, 1, 'My Second Book' UNION + SELECT 53, 2, 'My First Book' UNION + SELECT 54, 2, 'My Second Book' UNION + SELECT 55, 3, 'My First Book' UNION + SELECT 56, 4, 'My First Book' UNION + SELECT 57, 5, 'My First Book' UNION + SELECT 58, 2, 'My Second Book' UNION + SELECT 59, 3, 'My First Book' UNION + SELECT 60, 4, 'My First Book' UNION + SELECT 61, 1, 'My First Book' UNION + SELECT 62, 1, 'My Second Book' UNION + SELECT 63, 2, 'My First Book' UNION + SELECT 64, 2, 'My Second Book' UNION + SELECT 65, 3, 'My First Book' UNION + SELECT 66, 4, 'My First Book' UNION + SELECT 67, 5, 'My First Book' UNION + SELECT 68, 2, 'My Second Book' UNION + SELECT 69, 3, 'My First Book' UNION + SELECT 70, 4, 'My First Book' UNION + SELECT 71, 1, 'My First Book' UNION + SELECT 72, 1, 'My Second Book' UNION + SELECT 73, 2, 'My First Book' UNION + SELECT 74, 2, 'My Second Book' UNION + SELECT 75, 3, 'My First Book' UNION + SELECT 76, 4, 'My First Book' UNION + SELECT 77, 5, 'My First Book' UNION + SELECT 78, 2, 'My Second Book' UNION + SELECT 79, 3, 'My First Book' UNION + SELECT 80, 4, 'My First Book' UNION + SELECT 81, 1, 'My First Book' UNION + SELECT 82, 1, 'My Second Book' UNION + SELECT 83, 2, 'My First Book' UNION + SELECT 84, 2, 'My Second Book' UNION + SELECT 85, 3, 'My First Book' UNION + SELECT 86, 4, 'My First Book' UNION + SELECT 87, 5, 'My First Book' UNION + SELECT 88, 2, 'My Second Book' UNION + SELECT 89, 3, 'My First Book' UNION + SELECT 90, 4, 'My First Book' UNION + SELECT 91, 1, 'My First Book' UNION + SELECT 92, 1, 'My Second Book' UNION + SELECT 93, 2, 'My First Book' UNION + SELECT 94, 2, 'My Second Book' UNION + SELECT 95, 3, 'My First Book' UNION + SELECT 96, 4, 'My First Book' UNION + SELECT 97, 5, 'My First Book' UNION + SELECT 98, 2, 'My Second Book' UNION + SELECT 99, 3, 'My First Book' + +SET IDENTITY_INSERT [dbo].[Book] OFF +GO + diff --git a/Backup/TestHarnessExample/Scripts/Prepare Database.bat b/Backup/TestHarnessExample/Scripts/Prepare Database.bat new file mode 100644 index 0000000..1f1e74f --- /dev/null +++ b/Backup/TestHarnessExample/Scripts/Prepare Database.bat @@ -0,0 +1,3 @@ +DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c PREPARE + +pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Refresh Database.bat b/Backup/TestHarnessExample/Scripts/Refresh Database.bat new file mode 100644 index 0000000..122dddb --- /dev/null +++ b/Backup/TestHarnessExample/Scripts/Refresh Database.bat @@ -0,0 +1,3 @@ +DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c REFRESH + +pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat b/Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat new file mode 100644 index 0000000..3a73942 --- /dev/null +++ b/Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat @@ -0,0 +1,3 @@ +DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c FORCEREFRESH + +pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/TestFixtureBase.cs b/Backup/TestHarnessExample/TestFixtureBase.cs new file mode 100644 index 0000000..a2b847c --- /dev/null +++ b/Backup/TestHarnessExample/TestFixtureBase.cs @@ -0,0 +1,65 @@ +using System; +using System.Data.SqlClient; +using DataFresh; +using NUnit.Framework; + +namespace TestHarnessExample +{ + public class TestFixtureBase + { + public static SqlDataFresh dataFresh = null; + public static string connectionString = "user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=(local);"; + + public TestFixtureBase() + { + if(dataFresh == null) + { + dataFresh = new SqlDataFresh(connectionString); + } + } + + [SetUp] + public void SetUp() + { + Console.Out.WriteLine("Setup"); + if (dataFresh.HasDatabaseBeenModified()) + { + dataFresh.RefreshTheDatabase(); + } + } + + [TearDown] + public void TearDown() + { + Console.Out.WriteLine("TearDown"); + if (dataFresh.HasDatabaseBeenModified()) + { + Console.Out.WriteLine("Database Write"); + } + } + + #region Data Access Helpers + + public static void ExecuteNonQuery(string sql) + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + SqlCommand cmd = new SqlCommand(sql, conn); + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + + public static object ExecuteScalar(string sql) + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + SqlCommand cmd = new SqlCommand(sql, conn); + conn.Open(); + return cmd.ExecuteScalar(); + } + } + + #endregion + } +} \ No newline at end of file diff --git a/Backup/TestHarnessExample/TestHarnessExample.csproj b/Backup/TestHarnessExample/TestHarnessExample.csproj new file mode 100644 index 0000000..ae24df0 --- /dev/null +++ b/Backup/TestHarnessExample/TestHarnessExample.csproj @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Backup/Testing.DataFresh/DataFreshConsoleTester.cs b/Backup/Testing.DataFresh/DataFreshConsoleTester.cs new file mode 100644 index 0000000..24c1728 --- /dev/null +++ b/Backup/Testing.DataFresh/DataFreshConsoleTester.cs @@ -0,0 +1,116 @@ +using DataFresh; +using NUnit.Framework; + +namespace Testing.DataFresh +{ + [TestFixture] + public class DataFreshConsoleTester + { + [SetUp] + public void Setup() + { + ExecuteDataFreshConsole("PREPARE"); + } + + [TearDown] + public void TearDown() + { + ExecuteDataFreshConsole("REMOVE"); + } + + [Test] + public void NoArgs() + { + string[] args = new string[] {}; + DataFreshConsole console = new DataFreshConsole(); + console.Start(args); + } + + [Test] + public void BlankArgs() + { + string[] args = new string[] {"", ""}; + DataFreshConsole console = new DataFreshConsole(); + console.Start(args); + } + + [Test] + public void BadCommand() + { + DataFreshConsole console = ExecuteDataFreshConsole("BADCOMMAND"); + Assert.IsTrue(console.Results.ToString().IndexOf("Command 'BADCOMMAND' was not recognized") > -1); + } + + [Test] + public void PrepareCommand() + { + DataFreshConsole console = ExecuteDataFreshConsole("PREPARE"); + } + + [Test] + public void PrepareCommandIgnoreSnapshot() + { + DataFreshConsole console = ExecuteDataFreshConsole("PREPARE", "-ignoresnapshot", "1"); + + } + + [Test] + public void RefreshCommand() + { + ExecuteDataFreshConsole("REFRESH"); + } + + [Test, ExpectedException(typeof (SqlDataFreshException))] + public void RefreshWithoutPrepareCommand() + { + ExecuteDataFreshConsole("REMOVE"); + ExecuteDataFreshConsole("REFRESH"); + } + + [Test] + public void CheckResults() + { + DataFreshConsole console = ExecuteDataFreshConsole("REFRESH"); + Assert.IsTrue(console.Results.ToString().IndexOf("Entropy Zero") > -1); + } + + [Test] + public void PassServerInstanceNameCheckConnectionString() + { + string serverInstance = @"localhost\dev"; + DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); + Assert.AreEqual(5, console.arguments.Keys.Count); + Assert.AreEqual(serverInstance, console.arguments["s"]); + string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost\dev;"; + Assert.AreEqual(expectedConnectionString, console.connectionString); + } + + [Test] + public void PassServerNameCheckConnectionString() + { + string serverInstance = @"localhost"; + DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); + Assert.AreEqual(5, console.arguments.Keys.Count); + Assert.AreEqual(serverInstance, console.arguments["s"]); + string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost;"; + Assert.AreEqual(expectedConnectionString, console.connectionString); + } + + [Test] + public void CheckSnapshotPath() + { + //-sp "${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData"" + //-sp '${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData' + string snapshotPath = @"c:\temp"; + DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", "localhost", "DataFreshSample", "-sp", snapshotPath); + Assert.AreEqual(6, console.arguments.Keys.Count); + Assert.AreEqual(snapshotPath, console.arguments["sp"]); + } + + private static DataFreshConsole ExecuteDataFreshConsole(string command, params string[] options) + { + DataFreshConsole console = DataFreshConsole.Execute(command, "test", "test", "localhost", "DataFreshSample", options); + return console; + } + } +} \ No newline at end of file diff --git a/Backup/Testing.DataFresh/Database Files/Database.sql b/Backup/Testing.DataFresh/Database Files/Database.sql new file mode 100644 index 0000000..838d2aa --- /dev/null +++ b/Backup/Testing.DataFresh/Database Files/Database.sql @@ -0,0 +1,67 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Book]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Book] +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Author]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Author] +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Movie]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Movie] +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Movie2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Movie2] +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Check]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Check] +GO + +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Check Table With Spaces]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) +drop table [dbo].[Check Table With Spaces] +GO + +CREATE TABLE [Author] +( + [AuthorId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY + , [Lastname] VARCHAR(55) NOT NULL + , [Firstname] VARCHAR(25) NOT NULL +) +GO + +CREATE TABLE [Book] +( + [BookId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY + , [AuthorId] INT NOT NULL CONSTRAINT fk_Book_Author_AuthorId FOREIGN KEY ([AuthorId]) REFERENCES [Author]([AuthorId]) + , [Title] VARCHAR(55) NOT NULL +) +GO + +CREATE TABLE [Movie] +( + [MovieId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY + , [Title] VARCHAR(55) NOT NULL +) +GO + +CREATE TABLE [Movie2] +( + [MovieId] INT NOT NULL PRIMARY KEY + , [Title] VARCHAR(55) NOT NULL +) +GO + +CREATE TABLE [Check] +( + [MovieId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY + , [Title] VARCHAR(55) NOT NULL +) +GO + +CREATE TABLE [Check Table With Spaces] +( + [MovieId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY + , [Title] VARCHAR(55) NOT NULL +) +GO \ No newline at end of file diff --git a/Backup/Testing.DataFresh/Database Files/Deltas/PlaceHolder.txt b/Backup/Testing.DataFresh/Database Files/Deltas/PlaceHolder.txt new file mode 100644 index 0000000..e69de29 diff --git a/Backup/Testing.DataFresh/Database Files/Setup.sql b/Backup/Testing.DataFresh/Database Files/Setup.sql new file mode 100644 index 0000000..0b7c1ec --- /dev/null +++ b/Backup/Testing.DataFresh/Database Files/Setup.sql @@ -0,0 +1,44 @@ +if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[df_Setup]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) +drop procedure [dbo].[df_Setup] +GO + +CREATE PROCEDURE [dbo].[df_Setup] +AS + DELETE BOOK + DELETE AUTHOR + + PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Author' + SET IDENTITY_INSERT [dbo].[Author] ON + INSERT INTO [Author] + ( + [AuthorId] + , [Lastname] + , [Firstname] + ) + SELECT 1, 'Brockey', 'Michael' UNION + SELECT 2, 'Buxton', 'Stevem' UNION + SELECT 3, 'Jones', 'Happy' UNION + SELECT 4, 'Smith', 'john' UNION + SELECT 5, 'Johnson', 'Todd' + SET IDENTITY_INSERT [dbo].[Author] OFF + + PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Book' + SET IDENTITY_INSERT [dbo].[Book] ON + INSERT INTO [Book] + ( + [BookId] + , [AuthorId] + , [Title] + ) + SELECT 1, 1, 'My First Book' UNION + SELECT 2, 1, 'My Second Book' UNION + SELECT 3, 2, 'My First Book' UNION + SELECT 4, 2, 'My Second Book' UNION + SELECT 5, 3, 'My First Book' UNION + SELECT 6, 4, 'My First Book' UNION + SELECT 7, 5, 'My First Book' + SET IDENTITY_INSERT [dbo].[Book] OFF +GO + +EXEC df_SETUP +go diff --git a/Backup/Testing.DataFresh/SqlDataFreshTester.cs b/Backup/Testing.DataFresh/SqlDataFreshTester.cs new file mode 100644 index 0000000..dd1e243 --- /dev/null +++ b/Backup/Testing.DataFresh/SqlDataFreshTester.cs @@ -0,0 +1,325 @@ +using System; +using System.IO; +using DataFresh; +using EntropyZero.deltaRunner; +using NUnit.Framework; + +namespace Testing.DataFresh +{ + [TestFixture] + public class SqlDataFreshTester : TestFixtureBase + { + [Test, ExpectedException(typeof (InvalidOperationException), "The ConnectionString property has not been initialized.")] + public void PrepDatabaseforDataFresh_NoConnectionString() + { + SqlDataFresh dataFresh = new SqlDataFresh(null); + dataFresh.PrepareDatabaseforDataFresh(); + } + + [Test] + public void Encrypt() + { +// string key = "pass@word1"; +// +// string enc = ResourceManagement.Encrypt("test", key); +// Assert.AreEqual("test", ResourceManagement.Decrypt(enc, key)); + +// ResourceManagement.Encrypt(@"C:\development\dataFresh\DataFresh\Resources\PrepareDataFresh.sql", +// @"C:\development\dataFresh\DataFresh\Resources\PrepareDataFresh.sql.enc", key); + +// byte[] dec = ResourceManagement.GetDecryptedResourceBytes("DataFresh.Resources.PrepareDataFresh.sql.enc"); +// string decStr = System.Text.Encoding.ASCII.GetString(dec); +// Console.Out.WriteLine("decStr = {0}", decStr); + +// string str = ResourceManagement.GetDecryptedResource("DataFresh.Resources.PrepareDataFresh.sql"); +// Console.Out.WriteLine("str = {0}", str); + } + + [Test] + public void RemoveDataFresh() + { + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + + dataFresh.RemoveDataFreshFromDatabase(); + Assert.IsFalse(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); + } + + [Test] + public void PrepDatabaseforDataFresh() + { + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + + dataFresh.RemoveDataFreshFromDatabase(); + Assert.IsFalse(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); + Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); + + dataFresh.PrepareDatabaseforDataFresh(); + Assert.IsTrue(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); + Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); + Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); + Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); + Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); + } + + [Test] + public void SnapshopPath_ManualOverride() + { + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + DirectoryInfo tempPath = new DirectoryInfo(Path.GetTempPath()); + dataFresh.SnapshotPath = tempPath; + Console.Out.WriteLine("dataFresh.SnapshotPath.FullName = {0}", dataFresh.SnapshotPath.FullName); + Assert.AreEqual(tempPath.FullName, dataFresh.SnapshotPath.FullName); + } + + [Test] + public void SnapshopPath_ManualOverrideTrailingBackslash() + { + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + string tempPath = @"c:\temp\folder"; + dataFresh.SnapshotPath = new DirectoryInfo(tempPath); + Assert.AreEqual(@"c:\temp\folder\", dataFresh.SnapshotPath.FullName); + } + + [Test] + public void SnapshopPath_Resetting() + { + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + dataFresh.SnapshotPath = null; + Assert.IsTrue(dataFresh.SnapshotPath.FullName.IndexOf("Snapshot_DataFreshSample") > -1); + } + + [Test] + public void SnapshopPath() + { + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + Assert.IsTrue(dataFresh.SnapshotPath.FullName.IndexOf("Snapshot_DataFreshSample") > -1); + } + + [Test] + public void IdentityReseedDuringRefresh() + { + InitializeTheDatabase(); + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + dataFresh.PrepareDatabaseforDataFresh(true); + int id = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); + Assert.AreEqual(6, id); + dataFresh.RefreshTheDatabase(); + int id2 = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); + Assert.AreEqual(6, id2); + } + + [Test] + public void IdentityReseedDuringRefresh_TableWithNoRows() + { + InitializeTheDatabase(); + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + dataFresh.PrepareDatabaseforDataFresh(true); + int id = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); + Assert.AreEqual(1, id); + dataFresh.RefreshTheDatabase(); + int id2 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); + Assert.AreEqual(1, id2); + int id3 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world 2'); select @@identity;")); + Assert.AreEqual(2, id3); + } + + [Test] + public void IdentityReseedDuringRefresh_TableWithNoRows2() + { + InitializeTheDatabase(); + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + dataFresh.RemoveDataFreshFromDatabase(); + dataFresh.PrepareDatabaseforDataFresh(true); + ExecuteNonQuery("insert into movie2 (movieid, title) values (1, 'mike brockey takes over the world');"); + dataFresh.RefreshTheDatabase(); + } + + [Test] + public void IdentityReseedWorksWithTablesThatUseReservedWords() + { + InitializeTheDatabase(); + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + dataFresh.RemoveDataFreshFromDatabase(); + dataFresh.PrepareDatabaseforDataFresh(true); + ExecuteNonQuery("insert into [check] (title) values ('mike brockey takes over the world');"); + dataFresh.RefreshTheDatabase(); + } + + [Test] + public void RefreshTheDatabaseSpeedTests() + { + SqlDataFresh dataFresh = new SqlDataFresh(connectionString, true); + dataFresh.RemoveDataFreshFromDatabase(); + dataFresh.PrepareDatabaseforDataFresh(true); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); + dataFresh.RefreshTheDatabase(); + } + + [Test] + public void ShouldNotRefreshDeltaRunnerTable() + { + InitializeTheDatabase(); + SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + dataFresh.RemoveDataFreshFromDatabase(); + dataFresh.PrepareDatabaseforDataFresh(true); + ExecuteNonQuery("insert into [dr_deltaversion] ([latestdelta], [hash], [filename]) values (99, 'blah-hash', 'whatever file');"); + Assert.AreEqual(1, ExecuteScalar("select count(*) from [dr_deltaversion] where [filename] = 'whatever file'")); + dataFresh.RefreshTheDatabase(); + Assert.AreEqual(1, ExecuteScalar("select count(*) from [dr_deltaversion] where [filename] = 'whatever file'")); + } + + private void InitializeTheDatabase() + { + SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, new DirectoryInfo(deltaPath).FullName, true); + deltaRunner.PrepareForDeltaRunner(); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "Database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "Setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); + deltaRunner.ApplyDeltas(); + } + } +} \ No newline at end of file diff --git a/Backup/Testing.DataFresh/TestFixtureBase.cs b/Backup/Testing.DataFresh/TestFixtureBase.cs new file mode 100644 index 0000000..8d4d218 --- /dev/null +++ b/Backup/Testing.DataFresh/TestFixtureBase.cs @@ -0,0 +1,56 @@ +using System.Data.SqlClient; +using System.IO; +using EntropyZero.deltaRunner; +using NUnit.Framework; + +namespace Testing.DataFresh +{ + public class TestFixtureBase + { + public static string connectionString = "user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=(local);pooling=false;"; + public static string connectionStringMaster = "user id=test;password=test;Initial Catalog=Master;Data Source=(local);pooling=false;"; + public static string databaseFilesPath = @"..\..\Database Files\"; + public static string deltaPath = @"..\..\Database Files\Deltas"; + + [SetUp] + public void SetUp() + { + SqlDeltaRunner.CreateDatabase("DataFreshSample", connectionStringMaster, true); + DeltaRunnerInstance.ApplyDeltas(); + } + + public SqlDeltaRunner DeltaRunnerInstance + { + get + { + SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, deltaPath, true); + deltaRunner.PrepareForDeltaRunner(); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); + return deltaRunner; + } + } + + public void ExecuteNonQuery(string sql) + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + SqlCommand cmd = new SqlCommand(sql, conn); + cmd.CommandTimeout = 1200; + conn.Open(); + cmd.ExecuteNonQuery(); + } + } + + public object ExecuteScalar(string sql) + { + using (SqlConnection conn = new SqlConnection(connectionString)) + { + SqlCommand cmd = new SqlCommand(sql, conn); + cmd.CommandTimeout = 1200; + conn.Open(); + return cmd.ExecuteScalar(); + } + } + } +} \ No newline at end of file diff --git a/Backup/Testing.DataFresh/Testing.DataFresh.csproj b/Backup/Testing.DataFresh/Testing.DataFresh.csproj new file mode 100644 index 0000000..c344754 --- /dev/null +++ b/Backup/Testing.DataFresh/Testing.DataFresh.csproj @@ -0,0 +1,132 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFresh.Common/DataFresh.Common.csproj b/DataFresh.Common/DataFresh.Common.csproj index 7f4e12d..5dce723 100644 --- a/DataFresh.Common/DataFresh.Common.csproj +++ b/DataFresh.Common/DataFresh.Common.csproj @@ -1,119 +1,96 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Local + 7.10.6030 + 2.0 + {0BAA8852-1597-43BB-AF78-BABA707D4D86} + Debug + AnyCPU + + + DataFresh.Common + + JScript + Grid + IE50 + false + Library + DataFresh.Common + OnBuildSuccess + + + + v2.0 + + + 0.0 + + + bin\Debug\ + false + 285212672 + false + + DEBUG;TRACE + + true + 4096 + false + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + TRACE + + false + 4096 + false + + true + false + false + false + 4 + none + prompt + + + + System + + + System.Data + + + System.XML + + + + + Code + + + + + + + + + + + + + + \ No newline at end of file diff --git a/DataFresh/DataFresh.csproj b/DataFresh/DataFresh.csproj index 5b817ee..2a914b4 100644 --- a/DataFresh/DataFresh.csproj +++ b/DataFresh/DataFresh.csproj @@ -1,132 +1,108 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Local + 7.10.3077 + 2.0 + {05438358-2120-4D97-974E-ACF80F7EA6F7} + Debug + AnyCPU + + + DataFresh + + JScript + Grid + IE50 + false + Library + DataFresh + OnBuildSuccess + + + + v2.0 + + + 0.0 + + + bin\Debug\ + false + 285212672 + false + + DEBUG;TRACE + + true + 4096 + false + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + TRACE + + true + 4096 + false + + true + false + false + false + 4 + full + prompt + + + + System + + + System.Data + + + System.XML + + + + + Code + + + Code + + + Code + + + Code + + + Code + + + Code + + + + + + + + + + + \ No newline at end of file diff --git a/DataFreshUtil/DataFreshUtil.csproj b/DataFreshUtil/DataFreshUtil.csproj index 7b6e37b..0b424a0 100644 --- a/DataFreshUtil/DataFreshUtil.csproj +++ b/DataFreshUtil/DataFreshUtil.csproj @@ -1,109 +1,99 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + Local + 7.10.6030 + 2.0 + {D1044AB1-AB58-42E3-A37B-4099116982A5} + Debug + AnyCPU + App.ico + + DataFreshUtil + + JScript + Grid + IE50 + false + Exe + DataFreshUtil + OnBuildSuccess + + + + v2.0 + + + 0.0 + + + bin\Debug\ + false + 285212672 + false + + DEBUG;TRACE + + true + 4096 + false + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + TRACE + + false + 4096 + false + + true + false + false + false + 4 + none + prompt + + + + DataFresh + {05438358-2120-4D97-974E-ACF80F7EA6F7} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + System + + + System.Data + + + System.XML + + + + + Code + + + Code + + + + + + + + + \ No newline at end of file diff --git a/EntropyZero DataFresh Solution.sln b/EntropyZero DataFresh Solution.sln index 8a9727a..04af4f1 100644 --- a/EntropyZero DataFresh Solution.sln +++ b/EntropyZero DataFresh Solution.sln @@ -1,51 +1,43 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh", "DataFresh\DataFresh.csproj", "{05438358-2120-4D97-974E-ACF80F7EA6F7}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHarnessExample", "TestHarnessExample\TestHarnessExample.csproj", "{D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing.DataFresh", "Testing.DataFresh\Testing.DataFresh.csproj", "{3E910EED-904F-4A52-A611-9278B682EFD3}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFreshUtil", "DataFreshUtil\DataFreshUtil.csproj", "{D1044AB1-AB58-42E3-A37B-4099116982A5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh.Common", "DataFresh.Common\DataFresh.Common.csproj", "{0BAA8852-1597-43BB-AF78-BABA707D4D86}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug.ActiveCfg = Debug|.NET - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug.Build.0 = Debug|.NET - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release.ActiveCfg = Release|.NET - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release.Build.0 = Release|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug.ActiveCfg = Debug|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug.Build.0 = Debug|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release.ActiveCfg = Release|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release.Build.0 = Release|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug.ActiveCfg = Debug|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug.Build.0 = Debug|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Release.ActiveCfg = Release|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Release.Build.0 = Release|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug.ActiveCfg = Debug|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug.Build.0 = Debug|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release.ActiveCfg = Release|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release.Build.0 = Release|.NET - {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Debug.ActiveCfg = Debug|.NET - {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Release.ActiveCfg = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25123.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh", "DataFresh\DataFresh.csproj", "{05438358-2120-4D97-974E-ACF80F7EA6F7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHarnessExample", "TestHarnessExample\TestHarnessExample.csproj", "{D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing.DataFresh", "Testing.DataFresh\Testing.DataFresh.csproj", "{3E910EED-904F-4A52-A611-9278B682EFD3}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFreshUtil", "DataFreshUtil\DataFreshUtil.csproj", "{D1044AB1-AB58-42E3-A37B-4099116982A5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh.Common", "DataFresh.Common\DataFresh.Common.csproj", "{0BAA8852-1597-43BB-AF78-BABA707D4D86}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release|Any CPU.Build.0 = Release|Any CPU + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release|Any CPU.Build.0 = Release|Any CPU + {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3E910EED-904F-4A52-A611-9278B682EFD3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3E910EED-904F-4A52-A611-9278B682EFD3}.Release|Any CPU.Build.0 = Release|Any CPU + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release|Any CPU.Build.0 = Release|Any CPU + {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Release|Any CPU.ActiveCfg = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/TestHarnessExample/TestHarnessExample.csproj b/TestHarnessExample/TestHarnessExample.csproj index ae24df0..fdf8f6a 100644 --- a/TestHarnessExample/TestHarnessExample.csproj +++ b/TestHarnessExample/TestHarnessExample.csproj @@ -1,147 +1,113 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Local + 7.10.3077 + 2.0 + {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E} + Debug + AnyCPU + + + TestHarnessExample + + JScript + Grid + IE50 + false + Library + TestHarnessExample + OnBuildSuccess + + + + v2.0 + + + 0.0 + + + bin\Debug\ + false + 285212672 + false + + DEBUG;TRACE + + true + 4096 + false + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + TRACE + + true + 4096 + false + + true + false + false + false + 4 + full + prompt + + + + DataFresh + {05438358-2120-4D97-974E-ACF80F7EA6F7} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + nunit.framework + ..\DataFresh.Common\Assemblies\nunit.framework.dll + + + System + + + System.Data + + + System.XML + + + + + Code + + + Code + + + Code + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Testing.DataFresh/Testing.DataFresh.csproj b/Testing.DataFresh/Testing.DataFresh.csproj index c344754..3cb0ad3 100644 --- a/Testing.DataFresh/Testing.DataFresh.csproj +++ b/Testing.DataFresh/Testing.DataFresh.csproj @@ -1,132 +1,112 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Local + 7.10.6030 + 2.0 + {3E910EED-904F-4A52-A611-9278B682EFD3} + Debug + AnyCPU + + + Testing.DataFresh + + JScript + Grid + IE50 + false + Library + Testing.DataFresh + OnBuildSuccess + + + + v2.0 + + + 0.0 + + + bin\Debug\ + false + 285212672 + false + + DEBUG;TRACE + + true + 4096 + false + + false + false + false + false + 4 + full + prompt + + + bin\Release\ + false + 285212672 + false + + TRACE + + true + 4096 + false + + true + false + false + false + 4 + full + prompt + + + + DataFresh + {05438358-2120-4D97-974E-ACF80F7EA6F7} + {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + + + deltaRunner + ..\DataFresh.Common\Assemblies\deltaRunner.dll + + + nunit.framework + ..\DataFresh.Common\Assemblies\nunit.framework.dll + + + System + + + System.Data + + + System.XML + + + + + Code + + + Code + + + Code + + + + + + + + + + + \ No newline at end of file diff --git a/UpgradeLog.htm b/UpgradeLog.htm new file mode 100644 index 0000000000000000000000000000000000000000..bec75c8387b9423e0f3b84b5e5965ee54607b2c9 GIT binary patch literal 84806 zcmeI5`F9gZlE>@U-S_5y(7;YZFYO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N4 za8{5lolc@XzM-~yUSpxcXb^RNgjBezlT37C+A1|94c6Wo_q}B4-ll6iUE9j;16Acc zv@FU7d6()y^eFm;(#^{au8# zXxv}LyqRw0a$5P@x=vQa7W3JmlOfp`jpa4J1mxE&NlP=S3u@;+zXC~9(H(Q2$L?x&r=)32 v@}@iIKF@*n&V90;ydA0;rq9h?Cl_<2<}v^KGxotMn$}8fQg0WX`CIh=l~!i+ literal 0 HcmV?d00001 From 6931286df4cc81d07cf4a3d41b7acdfc44a14b32 Mon Sep 17 00:00:00 2001 From: Vladyslav Danylov Date: Tue, 14 Jun 2016 15:12:06 +0300 Subject: [PATCH 02/13] [PAA-1335] Changed SQL script to support different schemes in one database. --- DataFresh/Resources/PrepareDataFresh.sql | 106 +++++++++++++---------- 1 file changed, 58 insertions(+), 48 deletions(-) diff --git a/DataFresh/Resources/PrepareDataFresh.sql b/DataFresh/Resources/PrepareDataFresh.sql index 9c49153..5491448 100644 --- a/DataFresh/Resources/PrepareDataFresh.sql +++ b/DataFresh/Resources/PrepareDataFresh.sql @@ -18,10 +18,14 @@ IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_Table DROP PROCEDURE [dbo].[df_TableDataImport] GO -IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) - CREATE TABLE [dbo].[df_ChangeTracking] +IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) + DROP TABLE [dbo].[df_ChangeTracking] +GO + +CREATE TABLE [dbo].[df_ChangeTracking] ( - [TABLENAME] sysname + [TABLENAME] sysname, + [TABLESCHEMA] sysname ) GO @@ -33,16 +37,18 @@ AS DECLARE @sql NVARCHAR(4000) DECLARE @TableName VARCHAR(255) + DECLARE @TableSchema VARCHAR(255) - SELECT DISTINCT TableName INTO #ChangedTables FROM df_ChangeTracking + SELECT DISTINCT TableName, TableSchema INTO #ChangedTables FROM df_ChangeTracking TRUNCATE TABLE df_ChangeTracking DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tablename] from #ChangedTables + SELECT [tablename], [tableschema] from #ChangedTables UNION SELECT DISTINCT - OBJECT_NAME(fkeyid) AS Referenced_Table + OBJECT_NAME(fkeyid) AS Referenced_Table_Name, + OBJECT_SCHEMA_NAME(fkeyid) AS Referenced_Table_Schema FROM sysreferences sr INNER JOIN #ChangedTables ct ON sr.rkeyid = OBJECT_ID(ct.tablename) @@ -50,38 +56,38 @@ AS OPEN Table_Cursor -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN - SET @sql = N'Alter Table [' + @TableName + '] NOCHECK CONSTRAINT ALL' + SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] NOCHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema END -- Delete All data from Changed Tables and Refill DECLARE ChangedTable_Cursor CURSOR FOR - SELECT [tablename] FROM #ChangedTables WHERE tablename not in('df_ChangeTracking', 'dr_DeltaVersion') + SELECT [tablename], [tableschema] FROM #ChangedTables WHERE tablename not in('df_ChangeTracking', 'dr_DeltaVersion') OPEN ChangedTable_Cursor - FETCH NEXT FROM ChangedTable_Cursor INTO @TableName + FETCH NEXT FROM ChangedTable_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN PRINT @TableName - SET @sql = N'DELETE [' + @TableName + ']; DELETE df_ChangeTracking WHERE TableName=''' + @TableName + '''' + SET @sql = N'DELETE [' + @TableSchema + '].[' + @TableName + ']; DELETE FROM df_ChangeTracking WHERE TableName=''' + @TableName + ''' and TableSchema=''' + @TableSchema + '''' EXEC sp_executesql @sql - SET @sql = N'IF(SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_name = ''' + @TableName + ''' AND IDENT_SEED(TABLE_NAME) IS NOT NULL) > 0 + SET @sql = N'IF(SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = ''' + @TableSchema + ''' AND table_name = ''' + @TableName + ''' AND IDENT_SEED(TABLE_NAME) IS NOT NULL) > 0 BEGIN - DBCC CHECKIDENT ([' + @TableName + '], RESEED, 0) + DBCC CHECKIDENT ([' + @TableSchema + '.' + @TableName + '], RESEED, 0) END' EXEC sp_executesql @sql - SET @sql = N'BULK INSERT [' + @TableName + '] - FROM ''' + @BasePath + @TableName + '.df'' + SET @sql = N'BULK INSERT [' + @TableSchema + '].[' + @TableName + '] + FROM ''' + @BasePath + @TableSchema + '.' + @TableName + '.df'' WITH ( KEEPIDENTITY, @@ -90,19 +96,19 @@ AS )' EXEC sp_executesql @sql - FETCH NEXT FROM ChangedTable_Cursor INTO @TableName + FETCH NEXT FROM ChangedTable_Cursor INTO @TableName, @TableSchema END CLOSE ChangedTable_Cursor DEALLOCATE ChangedTable_Cursor -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableName + FETCH FIRST FROM Table_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN - SET @sql = N'Alter Table [' + @TableName + '] CHECK CONSTRAINT ALL' + SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] CHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema END CLOSE Table_Cursor DEALLOCATE Table_Cursor @@ -115,33 +121,35 @@ AS IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) CREATE TABLE [df_ChangeTracking] ( - [TABLENAME] sysname + [TABLENAME] sysname, + [TABLESCHEMA] sysname ) DECLARE @sql NVARCHAR(4000) DECLARE @TableName VARCHAR(255) + DECLARE @TableSchema VARCHAR(255) DECLARE Table_Cursor CURSOR FOR - SELECT [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' + SELECT [table_name], [table_schema] FROM information_schema.tables WHERE table_type = 'BASE TABLE' OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN - SET @sql = N'IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE ID = Object_ID(N''[dbo].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) - DROP TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + ']' + SET @sql = N'IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE ID = Object_ID(N''[' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) + DROP TRIGGER [' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']' EXEC sp_executesql @sql - SET @sql = N'CREATE TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + '] on [' + @TableName + '] for insert, update, delete + SET @sql = N'CREATE TRIGGER [' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + '] on [' + @TableSchema + '].[' + @TableName + '] for insert, update, delete as SET NOCOUNT ON - INSERT INTO df_ChangeTracking (tablename) VALUES (''' + @TableName + ''') + INSERT INTO df_ChangeTracking (tablename, tableschema) VALUES (''' + @TableName + ''', ''' + @TableSchema + ''') SET NOCOUNT OFF' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema END CLOSE Table_Cursor @@ -163,7 +171,7 @@ AS DECLARE @CMD NVARCHAR(4000) DECLARE Table_Cursor CURSOR FOR - SELECT N'bcp "' + DB_NAME() + '.dbo.[' + Table_Name + ']" out "' + @BasePath + Table_Name + '.df" -n -k -E -C 1252 -S ' + @@ServerName + ' -T' FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' + SELECT N'bcp "' + DB_NAME() + '.[' + Table_Schema + '].[' + Table_Name + ']" out "' + @BasePath + Table_Schema + '.' + Table_Name + '.df" -n -k -E -C 1252 -S ' + @@ServerName + ' -T' FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' OPEN Table_Cursor FETCH NEXT FROM Table_Cursor INTO @CMD @@ -187,39 +195,40 @@ AS DECLARE @sql NVARCHAR(4000) DECLARE @TableName VARCHAR(255) + DECLARE @TableSchema VARCHAR(255) - SELECT Table_Name as TableName INTO #UserTables FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' + SELECT Table_Name as TableName, Table_Schema as TableSchema INTO #UserTables FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tablename] FROM #UserTables + SELECT [tablename], [tableschema] FROM #UserTables OPEN Table_Cursor -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN - SET @sql = N'Alter Table [' + @TableName + '] NOCHECK CONSTRAINT ALL' + SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] NOCHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema END -- Delete All data from Changed Tables and Refill DECLARE UserTable_Cursor CURSOR FOR - SELECT [tablename] FROM #UserTables WHERE tablename not in ('df_ChangeTracking', 'dr_DeltaVersion') + SELECT [tablename], [tableschema] FROM #UserTables WHERE tablename not in ('df_ChangeTracking', 'dr_DeltaVersion') and tableschema <> 'dbo' OPEN UserTable_Cursor - FETCH NEXT FROM UserTable_Cursor INTO @TableName + FETCH NEXT FROM UserTable_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN - PRINT @TableName - SET @sql = N'DELETE [' + @TableName + ']' + PRINT @TableSchema + '.' + @TableName + SET @sql = N'DELETE [' + @TableSchema + '].[' + @TableName + ']' EXEC sp_executesql @sql - SET @sql = N'BULK INSERT [' + @TableName + '] + SET @sql = N'BULK INSERT [' + @TableSchema + '].[' + @TableName + '] FROM ''' + @BasePath + @TableName + '.df'' WITH ( @@ -229,20 +238,20 @@ AS )' EXEC sp_executesql @sql - FETCH NEXT FROM UserTable_Cursor INTO @TableName + FETCH NEXT FROM UserTable_Cursor INTO @TableName, @TableSchema END CLOSE UserTable_Cursor DEALLOCATE UserTable_Cursor -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableName + FETCH FIRST FROM Table_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN - SET @sql = N'Alter Table [' + @TableName + '] CHECK CONSTRAINT ALL' + SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] CHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema END CLOSE Table_Cursor @@ -254,21 +263,22 @@ CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerRemove] AS DECLARE @sql NVARCHAR(4000) DECLARE @TableName VARCHAR(255) + DECLARE @TableSchema VARCHAR(255) DECLARE Table_Cursor CURSOR FOR - SELECT [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' + SELECT [table_name], [table_schema] FROM information_schema.tables WHERE table_type = 'BASE TABLE' OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema WHILE (@@Fetch_Status = 0) BEGIN - SET @sql = N'IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = Object_ID(N''[dbo].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) - DROP TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + ']' + SET @sql = N'IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = Object_ID(N''[' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) + DROP TRIGGER [' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName + FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema END CLOSE Table_Cursor From d57de033a77f8afcbb0dff2364ed85412c32fb05 Mon Sep 17 00:00:00 2001 From: Vladyslav Danylov Date: Tue, 14 Jun 2016 15:23:06 +0300 Subject: [PATCH 03/13] [PAA-1336] Removed backup files created druring update to VS2015. --- .../Assemblies/deltaRunner.dll | Bin 45056 -> 0 bytes .../Assemblies/nunit.framework.dll | Bin 28672 -> 0 bytes Backup/DataFresh.Common/AssemblyInfo.cs | 58 --- Backup/DataFresh.Common/Build/buildPrefix.txt | 1 - Backup/DataFresh.Common/Build/default.build | 140 ------- .../DataFresh.Common/DataFresh.Common.csproj | 119 ------ .../DataFresh.Common/Database/PlaceHolder.txt | 0 .../Executables/PlaceHolder.txt | 0 Backup/DataFresh/AssemblyInfo.cs | 4 - Backup/DataFresh/DataFresh.csproj | 132 ------- Backup/DataFresh/DataFreshConsole.cs | 198 ---------- Backup/DataFresh/IDataFresh.cs | 65 ---- Backup/DataFresh/Readme.txt | 112 ------ Backup/DataFresh/ResourceManagement.cs | 148 -------- .../DataFresh/Resources/PrepareDataFresh.sql | 280 -------------- .../DataFresh/Resources/RemoveDataFresh.sql | 27 -- Backup/DataFresh/SqlDataFresh.cs | 277 -------------- Backup/DataFresh/SqlDataFreshException.cs | 30 -- Backup/DataFreshUtil/App.ico | Bin 1078 -> 0 bytes Backup/DataFreshUtil/AssemblyInfo.cs | 5 - Backup/DataFreshUtil/DataFreshUtil.csproj | 109 ------ Backup/DataFreshUtil/EntryPoint.cs | 31 -- Backup/EntropyZero DataFresh Solution.sln | 51 --- Backup/TestHarnessExample/MoreSampleTests.cs | 342 ------------------ Backup/TestHarnessExample/Readme.txt | 11 - Backup/TestHarnessExample/SampleTests.cs | 46 --- .../Scripts/Clean Database.bat | 3 - .../Scripts/Create Database.bat | 5 - .../Scripts/DataFresh Usage.bat | 2 - .../TestHarnessExample/Scripts/Database.sql | 196 ---------- .../Scripts/Prepare Database.bat | 3 - .../Scripts/Refresh Database.bat | 3 - .../Scripts/Refresh Entire Database.bat | 3 - Backup/TestHarnessExample/TestFixtureBase.cs | 65 ---- .../TestHarnessExample.csproj | 147 -------- .../DataFreshConsoleTester.cs | 116 ------ .../Database Files/Database.sql | 67 ---- .../Database Files/Deltas/PlaceHolder.txt | 0 .../Database Files/Setup.sql | 44 --- .../Testing.DataFresh/SqlDataFreshTester.cs | 325 ----------------- Backup/Testing.DataFresh/TestFixtureBase.cs | 56 --- .../Testing.DataFresh.csproj | 132 ------- DataFresh/AssemblyResourceEncrpytion.cs | 41 +++ UpgradeLog.htm | Bin 84806 -> 0 bytes 44 files changed, 41 insertions(+), 3353 deletions(-) delete mode 100644 Backup/DataFresh.Common/Assemblies/deltaRunner.dll delete mode 100644 Backup/DataFresh.Common/Assemblies/nunit.framework.dll delete mode 100644 Backup/DataFresh.Common/AssemblyInfo.cs delete mode 100644 Backup/DataFresh.Common/Build/buildPrefix.txt delete mode 100644 Backup/DataFresh.Common/Build/default.build delete mode 100644 Backup/DataFresh.Common/DataFresh.Common.csproj delete mode 100644 Backup/DataFresh.Common/Database/PlaceHolder.txt delete mode 100644 Backup/DataFresh.Common/Executables/PlaceHolder.txt delete mode 100644 Backup/DataFresh/AssemblyInfo.cs delete mode 100644 Backup/DataFresh/DataFresh.csproj delete mode 100644 Backup/DataFresh/DataFreshConsole.cs delete mode 100644 Backup/DataFresh/IDataFresh.cs delete mode 100644 Backup/DataFresh/Readme.txt delete mode 100644 Backup/DataFresh/ResourceManagement.cs delete mode 100644 Backup/DataFresh/Resources/PrepareDataFresh.sql delete mode 100644 Backup/DataFresh/Resources/RemoveDataFresh.sql delete mode 100644 Backup/DataFresh/SqlDataFresh.cs delete mode 100644 Backup/DataFresh/SqlDataFreshException.cs delete mode 100644 Backup/DataFreshUtil/App.ico delete mode 100644 Backup/DataFreshUtil/AssemblyInfo.cs delete mode 100644 Backup/DataFreshUtil/DataFreshUtil.csproj delete mode 100644 Backup/DataFreshUtil/EntryPoint.cs delete mode 100644 Backup/EntropyZero DataFresh Solution.sln delete mode 100644 Backup/TestHarnessExample/MoreSampleTests.cs delete mode 100644 Backup/TestHarnessExample/Readme.txt delete mode 100644 Backup/TestHarnessExample/SampleTests.cs delete mode 100644 Backup/TestHarnessExample/Scripts/Clean Database.bat delete mode 100644 Backup/TestHarnessExample/Scripts/Create Database.bat delete mode 100644 Backup/TestHarnessExample/Scripts/DataFresh Usage.bat delete mode 100644 Backup/TestHarnessExample/Scripts/Database.sql delete mode 100644 Backup/TestHarnessExample/Scripts/Prepare Database.bat delete mode 100644 Backup/TestHarnessExample/Scripts/Refresh Database.bat delete mode 100644 Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat delete mode 100644 Backup/TestHarnessExample/TestFixtureBase.cs delete mode 100644 Backup/TestHarnessExample/TestHarnessExample.csproj delete mode 100644 Backup/Testing.DataFresh/DataFreshConsoleTester.cs delete mode 100644 Backup/Testing.DataFresh/Database Files/Database.sql delete mode 100644 Backup/Testing.DataFresh/Database Files/Deltas/PlaceHolder.txt delete mode 100644 Backup/Testing.DataFresh/Database Files/Setup.sql delete mode 100644 Backup/Testing.DataFresh/SqlDataFreshTester.cs delete mode 100644 Backup/Testing.DataFresh/TestFixtureBase.cs delete mode 100644 Backup/Testing.DataFresh/Testing.DataFresh.csproj create mode 100644 DataFresh/AssemblyResourceEncrpytion.cs delete mode 100644 UpgradeLog.htm diff --git a/Backup/DataFresh.Common/Assemblies/deltaRunner.dll b/Backup/DataFresh.Common/Assemblies/deltaRunner.dll deleted file mode 100644 index 749e99d7418096ef48982697592b4f4d688fc964..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45056 zcmeHwd3+nywf~)wtldh+j^!*iQ5F)%Be}NaWn==xTM~!F3AVFAXwc?FU`vi9Ck`QC zO3Tth3$&%sLJM?FS7>RWlu{@=56Zrlq@_StC{W%H3Y75so--qB>?FMQ{od!-_lM-n zox7fU?)NNr8I7{$q)UWF2w}zb!3RRzj5~dnaroiEIEuY ztbZhv-j<0B`(u$*DxLF36aLI-%AZX6yVmymhtu&yU1_Onp+S0Gw-Bo(t5{;{>bJr> z&n?-67(r&eUhoXXr{fyu^mL9RO?=ZQe;3yyLG|#VadCpv2#kE=#-)yNA!;agjSyS( z29zp%E)l|0Nd5D%aUmS$+URtpDP5OKjOE5+;=rlMB!)(eJ8t=pUx-udlJQ6`B19i$ zj^m=bbT@sLL0om2#85hB@OlXfsUF=;pJhUH)Mc_6RMW?L4I)&J?xxSOe@^_S7R6{0 zfg%D$1d0e05hx;1M4*U35rHBCMFffn{BK8q_M|edg~thTW1|pmgW>zIFZ>=h)hlry zH}XF0rgXLk)?fCGhEI-#tiO4B#-CSyHrD4$?i=6qJ!#>EEB{h=(c+)|;_}j8TYs?l zjXTeNYeUJRS+^~0D0_bMj%DY(I&|Ns+aFxi@qj-J5#)2m1Xr{oSj(I|ux={^fmZ*ZAYnbX|6LHXS`J5zA%$8&`Jsb^DWX|FM2O zYilxI)4TX&R6C{a$>{}HrFKM0e|n}p6vQ;A~O() z4kb|SSbxKkQkS!{ue*Jq+dt6WvAWxDB7~wET+WmCH0(VECm}f`P=CeRQr8roOI?2B zg9iC%{yup){kyYkjiIdd_w@F5_xV???dkO+zcW2FI-JV-JN;{W{cG!bx{mEca410? zfq?RJ-tXeozC{v13>8z@%Y=jy8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q|p*I_x^n3UMzg0f<=|BBchQJ$zhvpMgD{*bQ20yfc-*?G>tQPul@C|sU za4Ww6*2ixf>aXqRU+1T~KexViklyX2D@Q-jVchBedZ3RL7iV)y54v!ZK$Twa$iH~o zgI5aZg$epBVHrFWjP{Jv2B#aXT(uD8ZPR02hx>Cd48w-LIc`0;Dw}m<7&an(i-M;C{1SNk zmBzIiZMR`mLp*x=4GiL%-jvIsjvp8Oe+%Y%x)g{yz518I`(AiQ3m-qOmC!Z`ui5A{ z=v^(MoF7;Im7^o!P~c6+Tz{cDj(57~4gIN@YmC|CI#ZE59BxawT|2m@*N^CZzaf4( n>7Qv!<1BuP2ow=0B2Yx2h(Hm6A_7GOiU<@DC?fE`1%dwyQUP;L diff --git a/Backup/DataFresh.Common/Assemblies/nunit.framework.dll b/Backup/DataFresh.Common/Assemblies/nunit.framework.dll deleted file mode 100644 index 220a58a9e13bad5323617edf097dd34dd55eb3ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 28672 zcmeHP3!Gb3ng7nYNhXudr0;1fQ<~C;p`8hxwjhs+opxF}^hu{JEp+XqGq=+~CK+y$ zwu2Sw1BA6AT`S6h@~R68y0D-YtcZ&8P*GO2zHmWYt;(+GB0p3f`~SXk@6AnS23d7~ zKYzQqZN7WH$N668JLjHrlXmraSCd6VA$(qamFO_;d@UCE+F&2p@oD$P>7M#;Oh2qv zePjBDotZ*nz{&SH>Hb7dI+x2A6Wi^CQ_3YWxkSg>u0(&n*G@Gy#%8*z*DWJjr7T)| ztf}3z_7ugZk5UoiM8Z%%x)pbBcjH4eR@!5X-%Mct<+>3N^bh}*I4+QZ;BWcvqD;cI z3VPRaqnl_QC!+e=N7PVFdp&r9C>oH90$&lpQ$>4E5%{4+0N_c&#ZR=|D*>-kPQmE` zF1~f6!7}Uc30#ZOJLTBfJOstpePFU&H$H)DG0~C$T5HxaP|H9q1GNm)GEmDvEd#X- z)G|=ZKrI8c4E#UJz&<`#uN6YZN#RL{h~w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VaS7$*7 zz9_9-wG7lU@V}n{{`Dadewe+l(w14e@#Bvnbe3Cz&*pBT=lQ|qUeD`=Xl=qTzqSD` z!(P1$@88$rS7O_6Uqj2y|GGz?5B>TTUX#6d>E4}x*Uy((n@rn-9cUoS=sxUQ-lc6ouLizRl%q7?s}*u{7f4%^ZY*xvD@Vzz%;{K zMN46=UrqrzXu;`3mb;k&9-p6bI8Uv?oljeQCGcqx8P8q^I0c+7c$Yr_O=Uk>b{@V1 zQGS%0AnV9Zl22rO&BvL8Kl9|nV=)2poDDvcIk@xrtLy=vHFB^~g!~T45PP;;PF)v* z)(hz@^d`l}Rp9lB299s^hSIgRl8~#sAZs*fm#M?8K`BT amVsIZY8j|ypq7DJ25K3oW#Ip22L2nBo6=zb diff --git a/Backup/DataFresh.Common/AssemblyInfo.cs b/Backup/DataFresh.Common/AssemblyInfo.cs deleted file mode 100644 index 9f89a32..0000000 --- a/Backup/DataFresh.Common/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// 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("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// 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 Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/Backup/DataFresh.Common/Build/buildPrefix.txt b/Backup/DataFresh.Common/Build/buildPrefix.txt deleted file mode 100644 index 2998829..0000000 --- a/Backup/DataFresh.Common/Build/buildPrefix.txt +++ /dev/null @@ -1 +0,0 @@ -1.1.0. diff --git a/Backup/DataFresh.Common/Build/default.build b/Backup/DataFresh.Common/Build/default.build deleted file mode 100644 index 9382f83..0000000 --- a/Backup/DataFresh.Common/Build/default.build +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if exists (Select * from sysdatabases where name = '${DatabaseName}') - BEGIN - - ALTER DATABASE [${DatabaseName}] - SET SINGLE_USER - WITH ROLLBACK IMMEDIATE - - DROP DATABASE [${DatabaseName}] - END; - - - - - - CREATE DATABASE [${DatabaseName}] - ON ( - NAME = N'${DatabaseName}_Data' - , FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL\Data\${DatabaseName}_Data.MDF' - , FILEGROWTH = 10%) - LOG ON ( - NAME = N'${DatabaseName}_Log' - , FILENAME = N'D:\Program Files\Microsoft SQL Server\MSSQL\Data\${DatabaseName}_log.LDF' - , FILEGROWTH = 10%) - COLLATE SQL_Latin1_General_CP1_CI_AS; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Backup/DataFresh.Common/DataFresh.Common.csproj b/Backup/DataFresh.Common/DataFresh.Common.csproj deleted file mode 100644 index 7f4e12d..0000000 --- a/Backup/DataFresh.Common/DataFresh.Common.csproj +++ /dev/null @@ -1,119 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Backup/DataFresh.Common/Database/PlaceHolder.txt b/Backup/DataFresh.Common/Database/PlaceHolder.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Backup/DataFresh.Common/Executables/PlaceHolder.txt b/Backup/DataFresh.Common/Executables/PlaceHolder.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Backup/DataFresh/AssemblyInfo.cs b/Backup/DataFresh/AssemblyInfo.cs deleted file mode 100644 index 6be57f4..0000000 --- a/Backup/DataFresh/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyTitleAttribute("dataFresh")] -[assembly: DataFresh.AssemblyResourceEncrpytion(false)] diff --git a/Backup/DataFresh/DataFresh.csproj b/Backup/DataFresh/DataFresh.csproj deleted file mode 100644 index 5b817ee..0000000 --- a/Backup/DataFresh/DataFresh.csproj +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Backup/DataFresh/DataFreshConsole.cs b/Backup/DataFresh/DataFreshConsole.cs deleted file mode 100644 index 6bc4fbd..0000000 --- a/Backup/DataFresh/DataFreshConsole.cs +++ /dev/null @@ -1,198 +0,0 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections.Specialized; -using System.IO; -using System.Text; - -namespace DataFresh -{ - public class DataFreshConsole - { - private StringBuilder results = new StringBuilder(); - - public NameValueCollection arguments = new NameValueCollection(); - public string connectionString = string.Empty; - - public string Results - { - get { return results.ToString(); } - } - - public void Start(string[] args) - { - ConsoleWrite("DataFresh provided by Entropy Zero Consulting"); - - if (args == null || args.Length < 2) - { - WriteUsage(); - return; - } - - for (int i = 0; i < args.Length; i = i + 2) - { - this.arguments.Add(args[i].Replace("-", ""), args[i + 1]); - //ConsoleWrite(args[i] + ": " +args[i+1]); - } - - if (!CheckForRequiredArguments(this.arguments)) - { - return; - } - - connectionString = string.Format(@"user id={0};password={1};Initial Catalog={2};Data Source={3};", - this.arguments["u"], - this.arguments["p"], - this.arguments["d"], - this.arguments["s"]); - - SqlDataFresh dataFresh = new SqlDataFresh(connectionString, true); - - string snapshotPath = this.arguments["sp"]; - - if (snapshotPath != null) - { - snapshotPath = snapshotPath.Replace("\"", ""); - if (!snapshotPath.EndsWith(@"\")) - { - snapshotPath += @"\"; - } - - ConsoleWrite("snapshotPath = {0}", snapshotPath); - string fullPath = Path.GetFullPath(snapshotPath); - ConsoleWrite("fullPath = {0}", fullPath); - dataFresh.SnapshotPath = new DirectoryInfo(snapshotPath); - } - - string command = this.arguments["c"].ToUpper(); - switch (command) - { - case "PREPARE": - bool ignoreSnapshot = false; - string ignoreSnapshotArgument = arguments["ignoresnapshot"]; - if(ignoreSnapshotArgument != null) - { - if(ignoreSnapshotArgument == "1") - { - ignoreSnapshot = true; - } - } - dataFresh.PrepareDatabaseforDataFresh(!ignoreSnapshot); - break; - case "REFRESH": - dataFresh.RefreshTheDatabase(); - break; - case "FORCEREFRESH": - dataFresh.RefreshTheEntireDatabase(); - break; - case "REMOVE": - dataFresh.RemoveDataFreshFromDatabase(); - break; - case "SNAPSHOT": - dataFresh.CreateSnapshot(); - break; - case "FOO": - //no nothing - break; - default: - ConsoleWrite("Command '{0}' was not recognized", command); - break; - } - } - - private void ConsoleWrite(string message, params object[] args) - { - results.AppendFormat(message, args); - results.AppendFormat(Environment.NewLine); - - Console.Out.WriteLine(message, args); - } - - private bool CheckForRequiredArguments(NameValueCollection myArgs) - { - if ( - myArgs == null || - myArgs["c"] == null || - myArgs["s"] == null || - myArgs["d"] == null || - myArgs["u"] == null || - myArgs["p"] == null - ) - { - ConsoleWrite("Missing required arguments."); - WriteUsage(); - return false; - } - return true; - } - - private void WriteUsage() - { - string usageText = @" -Usage: - - DataFreshUtil.exe - -c Command - -s Server - -d Database - -u Username - -p Password [options] - -Options: - - -sp specify path on server where snapshot files are located - -ignoresnapshot 1: ignore snapshot during prepare - 0: (default) will create snapshot - -Commands: - - PREPARE prepare the database for DataFresh - REFRESH refresh the database - FORCEREFRESH refresh the database ignoring the change tracking table - REMOVE remove the DataFresh elements from the database - SNAPSHOT create a snapshot of your database -"; - - ConsoleWrite(usageText); - } - - public static DataFreshConsole Execute(string command, string username, string password, string server, string database, params string[] options) - { - string[] args = new string[] - { - "-c", command, - "-u", username, - "-p", password, - "-s", server, - "-d", database, - }; - - if (options != null && options.Length > 1) - { - string argsString = string.Join("|", args); - string optionsString = string.Join("|", options); - args = string.Format(argsString + "|" + optionsString).Split('|'); - } - - DataFreshConsole console = new DataFreshConsole(); - console.Start(args); - return console; - } - } -} \ No newline at end of file diff --git a/Backup/DataFresh/IDataFresh.cs b/Backup/DataFresh/IDataFresh.cs deleted file mode 100644 index a030e17..0000000 --- a/Backup/DataFresh/IDataFresh.cs +++ /dev/null @@ -1,65 +0,0 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System.IO; - -namespace DataFresh -{ - public interface IDataFresh - { - /// - /// prepare the database to use the dataFresh library - /// - void PrepareDatabaseforDataFresh(); - - /// - /// refresh the database to a known state - /// - void RefreshTheDatabase(); - - /// - /// determine if the database has been modified - /// - /// true if modified - bool HasDatabaseBeenModified(); - - /// - /// remove the dataFresh objects from a database - /// - void RemoveDataFreshFromDatabase(); - - /// - /// refresh the database ignoring the dataFresh change tracking table. - /// - void RefreshTheEntireDatabase(); - - /// - /// create snapshot of database - /// - void CreateSnapshot(); - - /// - /// location on the server where the snapshot files are located - /// - DirectoryInfo SnapshotPath - { - get; - set; - } - } -} \ No newline at end of file diff --git a/Backup/DataFresh/Readme.txt b/Backup/DataFresh/Readme.txt deleted file mode 100644 index e60b907..0000000 --- a/Backup/DataFresh/Readme.txt +++ /dev/null @@ -1,112 +0,0 @@ -dataFresh by EntropyZero Consulting - -Entropy's dataFresh is a toolkit that assists test driven development -projects in restoring their database to a known state before each test within -a test fixture. The time consuming effort of having to write tear down -methods to clean up the database after running your tests are a thing of the -past. - -Our appoach is unlike others as we do not attempt to rip and replace the -entire database. Instead we track database modifications to the table -level and only work with those tables that have been modified. - - -Preparing your database - -Before you can use dataFresh to refresh your data you will need to prepare -your database. Calling the PrepareDatabaseforDataFresh method will connect -to the specified database and will create the dataFresh elements required -to track and refresh your data. - -Example: - - string connectionString = ""; - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.PrepareDatabaseforDataFresh(); - - -Create Snapshot - -As part of the call to the PrepareDatabaseforDataFresh method, we create -a snapshot of your database that will be used to refresh the database. -Alternativly you may request that the call to prepare the database skip -the snapshot step, in which case you will want to need to to call the -CreateSnapshot method manually before you will be able to refresh the -database. You may also override the filepath where there snapshot -resides by setting the SnapshotPath property. - -Example: - - string connectionString = ""; - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - bool createSnapshot = false; - dataFresh.PrepareDatabaseforDataFresh(createSnapshot); - - -Specify the SnapshotPath - -You may tell dataFresh where you want to save the snapshot files of your -database by setting the SnapshotPath property of your dataFresh instance. -Please be aware that the location will be referenced by and therefore -should be accessible to the SQL server. - -Example: - - string connectionString = ""; - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - bool createSnapshot = false; - DirectoryInfo snapshotPath = - new DirectoryInfo("d:\Sql\Data\Snapshot_DatabaseName"); - dataFresh.PrepareDatabaseforDataFresh(createSnapshot); - - -HasDatabaseBeenModified Method - -This method will strangely enough return true if your database has been -modified since the last refresh command. - -Example: - - string connectionString = ""; - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - if(dataFresh.HasDatabaseBeenModified) - { - Console.Out("Database has been modified!"); - dataFresh.RefreshTheDatabase(); - } - - -RefreshTheDatabase Method - -When called, this method will clear out the modified tables and refresh -the database from the snapshot files. If you specified an alternate -location for your snapshot files, please be sure the the SnapshotPath -property has been set before calling this command. - - -RefreshTheEntireDatabase Method - -When called, this method will clear out and refresh all tables regardless -if they have been modified or not. Again, If you specified an alternate -location for your snapshot files, please be sure the the SnapshotPath -property has been set before calling this command. - - -RemoveDataFreshFromDatabase - -When you are ready to move into production, or no longer need the help of -dataFresh, simply call the RemoveDataFreshFromDatabase method and we will -gladly remove all the dataFresh elements from your database. :) - - -dataFresh on the Command Line - -You can integrate dataFresh into your automated builds by using the command -line version of dataFresh. Here are some examples of the concepts listed -above. - -DataFreshUtil.exe -s 127.0.0.1 -u -p -d DataFreshSample -c PREPARE - -DataFreshUtil.exe -s 127.0.0.1 -u -p -d DataFreshSample -c REFRESH - -DataFreshUtil.exe -s 127.0.0.1 -u -p -d DataFreshSample -c REMOVE diff --git a/Backup/DataFresh/ResourceManagement.cs b/Backup/DataFresh/ResourceManagement.cs deleted file mode 100644 index d800bac..0000000 --- a/Backup/DataFresh/ResourceManagement.cs +++ /dev/null @@ -1,148 +0,0 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Reflection; -using System.Security.Cryptography; - -namespace DataFresh -{ - [AttributeUsage(AttributeTargets.Assembly)] - public class AssemblyResourceEncrpytion : Attribute - { - private bool enryptionEnabled; - private string enryptionKey = "nopassword"; - - public AssemblyResourceEncrpytion() - { - enryptionEnabled = true; - } - - public AssemblyResourceEncrpytion(bool enabled) - { - enryptionEnabled = enabled; - } - - public virtual bool Enabled - { - get - { - return enryptionEnabled; - } - set - { - enryptionEnabled = value; - } - } - - public virtual string Key - { - get - { - return enryptionKey; - } - } - } - - public class ResourceManagement - { - public static bool EncryptionEnabled - { - get - { - object[] customAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyResourceEncrpytion), false); - if(customAttributes != null && customAttributes.Length > 0) - { - AssemblyResourceEncrpytion enc = (AssemblyResourceEncrpytion) customAttributes[0]; - return enc.Enabled; - } - return false; - } - } - - public static string EncryptionKey - { - get - { - object[] customAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyResourceEncrpytion), false); - if(customAttributes != null && customAttributes.Length > 0) - { - AssemblyResourceEncrpytion enc = (AssemblyResourceEncrpytion) customAttributes[0]; - return enc.Key; - } - throw new Exception("Encryption key was not set!"); - } - } - - public static string GetDecryptedResource(string name) - { - byte[] dec = GetDecryptedResourceBytes(name); - string decStr = new MemoryStream(dec).ToString(); - return decStr; - } - - public static StreamReader GetDecryptedResourceStream(string name) - { - StreamReader reader = new StreamReader(new MemoryStream(GetDecryptedResourceBytes(name))); - return reader; - } - - public static byte[] GetDecryptedResourceBytes(string name) - { - Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name); - int length = (int)stream.Length; - byte[] bytes = new byte[length]; - stream.Read(bytes, 0, length); - if(EncryptionEnabled) - { - return Decrypt(bytes, EncryptionKey); - } - else - { - return bytes; - } - } - - public static byte[] Decrypt(byte[] cipherData, byte[] Key, byte[] IV) - { - MemoryStream ms = new MemoryStream(); - Rijndael alg = Rijndael.Create(); - alg.Key = Key; - alg.IV = IV; - CryptoStream cs = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write); - cs.Write(cipherData, 0, cipherData.Length); - cs.Flush(); - cs.Close(); - byte[] decryptedData = ms.ToArray(); - return decryptedData; - } - - public static byte[] Decrypt(byte[] cipherData, string Password) - { - PasswordDeriveBytes pdb = new PasswordDeriveBytes(Password, - new byte[] - { - 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, - 0x65, 0x76 - }); - - return Decrypt(cipherData, pdb.GetBytes(32), pdb.GetBytes(16)); - } - } -} diff --git a/Backup/DataFresh/Resources/PrepareDataFresh.sql b/Backup/DataFresh/Resources/PrepareDataFresh.sql deleted file mode 100644 index 9c49153..0000000 --- a/Backup/DataFresh/Resources/PrepareDataFresh.sql +++ /dev/null @@ -1,280 +0,0 @@ -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangedTableDataRefresh]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangedTableDataRefresh] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerCreate]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerCreate] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerRemove] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataExtract]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataExtract] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataImport]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataImport] -GO - -IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) - CREATE TABLE [dbo].[df_ChangeTracking] - ( - [TABLENAME] sysname - ) -GO - -CREATE PROCEDURE dbo.[df_ChangedTableDataRefresh] -( - @BasePath NVARCHAR(512) -) -AS - - DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) - - SELECT DISTINCT TableName INTO #ChangedTables FROM df_ChangeTracking - - TRUNCATE TABLE df_ChangeTracking - - DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tablename] from #ChangedTables - UNION - SELECT DISTINCT - OBJECT_NAME(fkeyid) AS Referenced_Table - FROM - sysreferences sr - INNER JOIN #ChangedTables ct ON sr.rkeyid = OBJECT_ID(ct.tablename) - - OPEN Table_Cursor - - -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableName + '] NOCHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableName - END - - -- Delete All data from Changed Tables and Refill - DECLARE ChangedTable_Cursor CURSOR FOR - SELECT [tablename] FROM #ChangedTables WHERE tablename not in('df_ChangeTracking', 'dr_DeltaVersion') - - OPEN ChangedTable_Cursor - FETCH NEXT FROM ChangedTable_Cursor INTO @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - PRINT @TableName - SET @sql = N'DELETE [' + @TableName + ']; DELETE df_ChangeTracking WHERE TableName=''' + @TableName + '''' - EXEC sp_executesql @sql - - SET @sql = N'IF(SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_name = ''' + @TableName + ''' AND IDENT_SEED(TABLE_NAME) IS NOT NULL) > 0 - BEGIN - DBCC CHECKIDENT ([' + @TableName + '], RESEED, 0) - END' - - EXEC sp_executesql @sql - - - SET @sql = N'BULK INSERT [' + @TableName + '] - FROM ''' + @BasePath + @TableName + '.df'' - WITH - ( - KEEPIDENTITY, - KEEPNULLS, - DATAFILETYPE=''native'' - )' - EXEC sp_executesql @sql - - FETCH NEXT FROM ChangedTable_Cursor INTO @TableName - END - CLOSE ChangedTable_Cursor - DEALLOCATE ChangedTable_Cursor - - -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableName + '] CHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableName - END - CLOSE Table_Cursor - DEALLOCATE Table_Cursor -GO - - -CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerCreate] -AS - - IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) - CREATE TABLE [df_ChangeTracking] - ( - [TABLENAME] sysname - ) - - DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) - - DECLARE Table_Cursor CURSOR FOR - SELECT [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' - - OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE ID = Object_ID(N''[dbo].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) - DROP TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + ']' - EXEC sp_executesql @sql - - SET @sql = N'CREATE TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + '] on [' + @TableName + '] for insert, update, delete - as - SET NOCOUNT ON - INSERT INTO df_ChangeTracking (tablename) VALUES (''' + @TableName + ''') - SET NOCOUNT OFF' - - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableName - - END - CLOSE Table_Cursor - DEALLOCATE Table_Cursor - -GO - -CREATE PROCEDURE dbo.[df_TableDataExtract] -( - @BasePath NVARCHAR(512) -) -AS - - DECLARE @MkDirCmd NVARCHAR(4000) - - SET @MkDirCmd = N'MKDIR "' + @BASEPATH + '"' - EXEC master.dbo.xp_cmdshell @MkDirCmd, no_output - - DECLARE @CMD NVARCHAR(4000) - - DECLARE Table_Cursor CURSOR FOR - SELECT N'bcp "' + DB_NAME() + '.dbo.[' + Table_Name + ']" out "' + @BasePath + Table_Name + '.df" -n -k -E -C 1252 -S ' + @@ServerName + ' -T' FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' - - OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @CMD - - WHILE (@@Fetch_Status = 0) - BEGIN - EXEC master.dbo.xp_cmdshell @CMD, no_output - FETCH NEXT FROM Table_Cursor INTO @CMD - END - - CLOSE Table_Cursor - Deallocate Table_Cursor - -GO - -CREATE PROCEDURE dbo.[df_TableDataImport] -( - @BasePath NVARCHAR(512) -) -AS - - DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) - - SELECT Table_Name as TableName INTO #UserTables FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' - - DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tablename] FROM #UserTables - - OPEN Table_Cursor - - -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableName + '] NOCHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableName - END - - -- Delete All data from Changed Tables and Refill - DECLARE UserTable_Cursor CURSOR FOR - SELECT [tablename] FROM #UserTables WHERE tablename not in ('df_ChangeTracking', 'dr_DeltaVersion') - - OPEN UserTable_Cursor - - FETCH NEXT FROM UserTable_Cursor INTO @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - PRINT @TableName - SET @sql = N'DELETE [' + @TableName + ']' - EXEC sp_executesql @sql - - SET @sql = N'BULK INSERT [' + @TableName + '] - FROM ''' + @BasePath + @TableName + '.df'' - WITH - ( - KEEPIDENTITY, - KEEPNULLS, - DATAFILETYPE=''native'' - )' - EXEC sp_executesql @sql - - FETCH NEXT FROM UserTable_Cursor INTO @TableName - - END - CLOSE UserTable_Cursor - DEALLOCATE UserTable_Cursor - - -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableName + '] CHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableName - END - - CLOSE Table_Cursor - DEALLOCATE Table_Cursor - -GO - -CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerRemove] -AS - DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) - - DECLARE Table_Cursor CURSOR FOR - SELECT [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' - - OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = Object_ID(N''[dbo].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) - DROP TRIGGER [dbo].[trig_df_ChangeTracking_' + @TableName + ']' - - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableName - - END - CLOSE Table_Cursor - DEALLOCATE Table_Cursor - - IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) - DROP TABLE [dbo].[df_ChangeTracking] - -GO \ No newline at end of file diff --git a/Backup/DataFresh/Resources/RemoveDataFresh.sql b/Backup/DataFresh/Resources/RemoveDataFresh.sql deleted file mode 100644 index bf75522..0000000 --- a/Backup/DataFresh/Resources/RemoveDataFresh.sql +++ /dev/null @@ -1,27 +0,0 @@ -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - EXEC df_ChangeTrackingTriggerRemove -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangedTableDataRefresh]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangedTableDataRefresh] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerCreate]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerCreate] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerRemove] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataExtract]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataExtract] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataImport]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataImport] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTracking]') AND OBJECTPROPERTY(ID, N'IsTable') = 1) - DROP TABLE [dbo].[df_ChangeTracking] -GO \ No newline at end of file diff --git a/Backup/DataFresh/SqlDataFresh.cs b/Backup/DataFresh/SqlDataFresh.cs deleted file mode 100644 index 930aeee..0000000 --- a/Backup/DataFresh/SqlDataFresh.cs +++ /dev/null @@ -1,277 +0,0 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Data.SqlClient; -using System.IO; -using System.Text; - -namespace DataFresh -{ - /// - /// dataFresh by Entropy Zero Consulting is a library that will enable - /// the test driven developer to build a test harness that will refresh - /// the database to a known state between tests - /// - public class SqlDataFresh : IDataFresh - { - #region Member Variables - - private string connectionString = null; - private DirectoryInfo snapshotPath = null; - - private string PrepareScriptResourceName = "DataFresh.Resources.PrepareDataFresh.sql"; - private string RemoveScriptResourceName = "DataFresh.Resources.RemoveDataFresh.sql"; - - public string PrepareProcedureName = "df_ChangeTrackingTriggerCreate"; - public string RefreshProcedureName = "df_ChangedTableDataRefresh"; - public string ExtractProcedureName = "df_TableDataExtract"; - public string ImportProcedureName = "df_TableDataImport"; - public string ChangeTrackingTableName = "df_ChangeTracking"; - - private bool verbose = false; - - #endregion - - #region Public Methods - - public SqlDataFresh(string connectionString) - { - this.connectionString = connectionString; - } - - public SqlDataFresh(string connectionString, bool verbose) - { - this.connectionString = connectionString; - this.verbose = verbose; - } - - public bool TableExists(string tableName) - { - int tableCount = Int32.Parse(ExecuteScalar(string.Format("SELECT COUNT(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='{0}'", tableName)).ToString()); - return (tableCount > 0); - } - - public bool ProcedureExists(string procedureName) - { - int procedureCount = Int32.Parse(ExecuteScalar(string.Format("SELECT COUNT(ROUTINE_NAME) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='{0}'", procedureName)).ToString()); - return (procedureCount > 0); - } - - #endregion - - #region IDataFresh Members - - /// - /// prepare the database to use the dataFresh library - /// - public void PrepareDatabaseforDataFresh() - { - PrepareDatabaseforDataFresh(true); - } - - public void PrepareDatabaseforDataFresh(bool createSnapshot) - { - DateTime before = DateTime.Now; - ConsoleWrite("PrepareDatabaseforDataFresh Started"); - RunSqlScript(ResourceManagement.GetDecryptedResourceStream(PrepareScriptResourceName)); - - ExecuteNonQuery("exec " + PrepareProcedureName); - - if(createSnapshot) - { - CreateSnapshot(); - } - ConsoleWrite("PrepareDatabaseforDataFresh Complete : " + (DateTime.Now - before)); - } - - /// - /// remove the dataFresh objects from a database - /// - public void RemoveDataFreshFromDatabase() - { - DateTime before = DateTime.Now; - ConsoleWrite("RemoveDataFreshFromDatabase Started"); - RunSqlScript(ResourceManagement.GetDecryptedResourceStream(RemoveScriptResourceName)); - ConsoleWrite("RemoveDataFreshFromDatabase Complete : " + (DateTime.Now - before)); - } - - /// - /// refresh the database to a known state - /// - public void RefreshTheDatabase() - { - DateTime before = DateTime.Now; - ConsoleWrite("RefreshTheDatabase Started"); - if (!ProcedureExists(RefreshProcedureName)) - { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); - } - ExecuteNonQuery(string.Format("exec {0} '{1}'", RefreshProcedureName, SnapshotPath.FullName)); - ConsoleWrite("RefreshTheDatabase Complete : " + (DateTime.Now - before)); - } - - /// - /// refresh the database ignoring the dataFresh change tracking table. - /// - public void RefreshTheEntireDatabase() - { - DateTime before = DateTime.Now; - ConsoleWrite("RefreshTheEntireDatabase Started"); - if (!ProcedureExists(ImportProcedureName)) - { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); - } - ExecuteNonQuery(string.Format("exec {0} '{1}'", ImportProcedureName, SnapshotPath.FullName)); - ConsoleWrite("RefreshTheEntireDatabase Complete : " + (DateTime.Now - before)); - } - - /// - /// create snapshot of database - /// - public void CreateSnapshot() - { - DateTime before = DateTime.Now; - ConsoleWrite("CreateSnapshot Started"); - if (!ProcedureExists(ExtractProcedureName)) - { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); - } - ExecuteNonQuery(string.Format("exec {0} '{1}'", ExtractProcedureName, SnapshotPath.FullName)); - ConsoleWrite("CreateSnapshot Complete : " + (DateTime.Now - before)); - } - - /// - /// determine if the database has been modified - /// - /// true if modified. - public bool HasDatabaseBeenModified() - { - if (!TableExists(ChangeTrackingTableName)) - { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); - } - - string sql = string.Format(@"SELECT COUNT(*) FROM {0} WHERE TableName <> '{0}'", ChangeTrackingTableName); - int ret = Convert.ToInt32(ExecuteScalar(sql)); - return ret > 0; - } - - /// - /// location on the server where the snapshot files are located - /// - public DirectoryInfo SnapshotPath - { - get - { - if (snapshotPath == null) - { - return GetSnapshopPath(); - } - return snapshotPath; - } - set - { - snapshotPath = CheckForIllegalCharsAndAppendTrailingSlash(value); - } - } - - #endregion - - #region Private Methods - - private static DirectoryInfo CheckForIllegalCharsAndAppendTrailingSlash(DirectoryInfo value) - { - if(value == null) - { - return null; - } - string path = value.FullName; - path = path.Replace("\"", ""); - if(!path.EndsWith(@"\")) - { - path += @"\"; - } - return new DirectoryInfo(path); - } - - private object ExecuteScalar(string sql) - { - using (SqlConnection conn = new SqlConnection(connectionString)) - { - sql = sql + " --dataProfilerIgnore"; - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; - conn.Open(); - return cmd.ExecuteScalar(); - } - } - - private void ExecuteNonQuery(string sql) - { - using (SqlConnection conn = new SqlConnection(connectionString)) - { - sql = sql + " --dataProfilerIgnore"; - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; - conn.Open(); - cmd.ExecuteNonQuery(); - } - } - - private DirectoryInfo GetSnapshopPath() - { - string dbName = (string) ExecuteScalar("SELECT DB_Name()"); - string mdfFilePath = Path.GetDirectoryName(ExecuteScalar("select filename from sysfiles where filename like '%.MDF%'").ToString().Trim()); - return new DirectoryInfo(string.Format(@"{0}\Snapshot_{1}\", mdfFilePath, dbName)); - } - - private void RunSqlScript(StreamReader reader) - { - string line = ""; - StringBuilder cmd = new StringBuilder(); - while ((line = reader.ReadLine()) != null) - { - if (line.Trim().ToLower().Equals("go")) - { - ExecuteNonQuery(cmd.ToString()); - cmd.Length = 0; - } - else - { - cmd.Append(line); - cmd.Append(Environment.NewLine); - } - } - if (cmd.ToString().Trim().Length > 0) - { - ExecuteNonQuery(cmd.ToString()); - } - } - - private void ConsoleWrite(string message) - { - if(this.verbose) - { - Console.Out.WriteLine(message); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Backup/DataFresh/SqlDataFreshException.cs b/Backup/DataFresh/SqlDataFreshException.cs deleted file mode 100644 index 29afec1..0000000 --- a/Backup/DataFresh/SqlDataFreshException.cs +++ /dev/null @@ -1,30 +0,0 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; - -namespace DataFresh -{ - public class SqlDataFreshException : ApplicationException - { - public SqlDataFreshException(string message) : base(message) - { - - } - } -} diff --git a/Backup/DataFreshUtil/App.ico b/Backup/DataFreshUtil/App.ico deleted file mode 100644 index 3a5525fd794f7a7c5c8e6187f470ea3af38cd2b6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1078 zcmeHHJr05}7=1t!Hp3A*8IHkVf+j?-!eHY14Gtcw1Eb*_9>Bq^zETJ@GKj{_2j4$w zo9}xCh!8{T3=X##Skq>ikMjsvB|y%crWBM2iW(4pI}c%z6%lW!=~4v77#3{z!dmB1 z__&l)-{KUYR+|8|;wB^R|9ET$J@(@=#rd^=)qs85?vAy(PSF5CyNkus435LVkZ$rj zNw|JG-P7^hF<(;#o*Vk}5R#e|^13tBbQkeF?djULtvqyxd3<{9 diff --git a/Backup/DataFreshUtil/AssemblyInfo.cs b/Backup/DataFreshUtil/AssemblyInfo.cs deleted file mode 100644 index 700e112..0000000 --- a/Backup/DataFreshUtil/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyVersionAttribute("1.0.0.0")] -[assembly: AssemblyTitleAttribute("dataFresh Console Utility")] - diff --git a/Backup/DataFreshUtil/DataFreshUtil.csproj b/Backup/DataFreshUtil/DataFreshUtil.csproj deleted file mode 100644 index 7b6e37b..0000000 --- a/Backup/DataFreshUtil/DataFreshUtil.csproj +++ /dev/null @@ -1,109 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Backup/DataFreshUtil/EntryPoint.cs b/Backup/DataFreshUtil/EntryPoint.cs deleted file mode 100644 index 3abcf8c..0000000 --- a/Backup/DataFreshUtil/EntryPoint.cs +++ /dev/null @@ -1,31 +0,0 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using DataFresh; - -namespace DataFreshUtil -{ - public class EntryPoint - { - public static void Main(string[] args) - { - DataFreshConsole console = new DataFreshConsole(); - console.Start(args); - } - } -} \ No newline at end of file diff --git a/Backup/EntropyZero DataFresh Solution.sln b/Backup/EntropyZero DataFresh Solution.sln deleted file mode 100644 index 8a9727a..0000000 --- a/Backup/EntropyZero DataFresh Solution.sln +++ /dev/null @@ -1,51 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh", "DataFresh\DataFresh.csproj", "{05438358-2120-4D97-974E-ACF80F7EA6F7}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHarnessExample", "TestHarnessExample\TestHarnessExample.csproj", "{D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testing.DataFresh", "Testing.DataFresh\Testing.DataFresh.csproj", "{3E910EED-904F-4A52-A611-9278B682EFD3}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFreshUtil", "DataFreshUtil\DataFreshUtil.csproj", "{D1044AB1-AB58-42E3-A37B-4099116982A5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataFresh.Common", "DataFresh.Common\DataFresh.Common.csproj", "{0BAA8852-1597-43BB-AF78-BABA707D4D86}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug.ActiveCfg = Debug|.NET - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Debug.Build.0 = Debug|.NET - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release.ActiveCfg = Release|.NET - {05438358-2120-4D97-974E-ACF80F7EA6F7}.Release.Build.0 = Release|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug.ActiveCfg = Debug|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Debug.Build.0 = Debug|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release.ActiveCfg = Release|.NET - {D688D8F0-3CDE-4C39-BF81-ED8C210C8F8E}.Release.Build.0 = Release|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug.ActiveCfg = Debug|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Debug.Build.0 = Debug|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Release.ActiveCfg = Release|.NET - {3E910EED-904F-4A52-A611-9278B682EFD3}.Release.Build.0 = Release|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug.ActiveCfg = Debug|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Debug.Build.0 = Debug|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release.ActiveCfg = Release|.NET - {D1044AB1-AB58-42E3-A37B-4099116982A5}.Release.Build.0 = Release|.NET - {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Debug.ActiveCfg = Debug|.NET - {0BAA8852-1597-43BB-AF78-BABA707D4D86}.Release.ActiveCfg = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/Backup/TestHarnessExample/MoreSampleTests.cs b/Backup/TestHarnessExample/MoreSampleTests.cs deleted file mode 100644 index c87ea22..0000000 --- a/Backup/TestHarnessExample/MoreSampleTests.cs +++ /dev/null @@ -1,342 +0,0 @@ -using System; -using NUnit.Framework; - -namespace TestHarnessExample -{ - [TestFixture] - public class MoreSampleTests : TestFixtureBase - { - [Test] - public void SampleDatabaseWriteTest1() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest2() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest3() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest4() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest5() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest6() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest7() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest8() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest9() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest10() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest11() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest12() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest13() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest14() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest15() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest16() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest17() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest18() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest19() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest20() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest21() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest22() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest23() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest24() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest25() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest26() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest27() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest28() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest29() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest30() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest31() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest32() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - - [Test] - public void SampleDatabaseWriteTest33() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest34() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest35() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest36() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - } -} \ No newline at end of file diff --git a/Backup/TestHarnessExample/Readme.txt b/Backup/TestHarnessExample/Readme.txt deleted file mode 100644 index 708e823..0000000 --- a/Backup/TestHarnessExample/Readme.txt +++ /dev/null @@ -1,11 +0,0 @@ -Using the dataFresh Sample - -1. Copy the files from the Scripts folder to a folder on your desktop. - -2. Copy and DataFreshUtil.exe to the same folder on your desktop. - -3. Create a database on your local sql server instance names DataFreshSample - -4. Modify the appropriate authentication arguments to login to your sql server. - -5. Execute "Create Database.bat" -- This will populate the DataFreshSample database and prepare it by adding the DataFresh elements. \ No newline at end of file diff --git a/Backup/TestHarnessExample/SampleTests.cs b/Backup/TestHarnessExample/SampleTests.cs deleted file mode 100644 index 1b61c6d..0000000 --- a/Backup/TestHarnessExample/SampleTests.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using NUnit.Framework; - -namespace TestHarnessExample -{ - [TestFixture] - public class SampleTests : TestFixtureBase - { - [Test] - public void SampleDatabaseWriteTest() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseWriteTest2() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - } - - [Test] - public void SampleDatabaseWriteTest3() - { - Console.Out.WriteLine("Test"); - Assert.AreEqual("Brockey", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - ExecuteNonQuery("UPDATE Author SET LastName='TEST'"); - Assert.AreEqual("TEST", (string) ExecuteScalar("SELECT LastName FROM Author WHERE AuthorId=1")); - Assert.AreEqual("My First Book", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - ExecuteNonQuery("UPDATE Book SET Title='New Title' WHERE BookId=1"); - Assert.AreEqual("New Title", (string) ExecuteScalar("SELECT Title FROM Book WHERE BookId=1")); - } - - [Test] - public void SampleDatabaseReadTest() - { - Console.Out.WriteLine("Test"); - ExecuteNonQuery("SELECT * FROM Book WHERE BookId=1"); - } - } -} \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Clean Database.bat b/Backup/TestHarnessExample/Scripts/Clean Database.bat deleted file mode 100644 index 42bebd1..0000000 --- a/Backup/TestHarnessExample/Scripts/Clean Database.bat +++ /dev/null @@ -1,3 +0,0 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c REMOVE - -pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Create Database.bat b/Backup/TestHarnessExample/Scripts/Create Database.bat deleted file mode 100644 index 152f83c..0000000 --- a/Backup/TestHarnessExample/Scripts/Create Database.bat +++ /dev/null @@ -1,5 +0,0 @@ -osql.exe -S 127.0.0.1 -U test -P test -d DataFreshSample -i database.sql - -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c PREPARE - -pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/DataFresh Usage.bat b/Backup/TestHarnessExample/Scripts/DataFresh Usage.bat deleted file mode 100644 index 94f05ca..0000000 --- a/Backup/TestHarnessExample/Scripts/DataFresh Usage.bat +++ /dev/null @@ -1,2 +0,0 @@ -DataFreshUtil.exe -pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Database.sql b/Backup/TestHarnessExample/Scripts/Database.sql deleted file mode 100644 index 618b1cf..0000000 --- a/Backup/TestHarnessExample/Scripts/Database.sql +++ /dev/null @@ -1,196 +0,0 @@ -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Book]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Book] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Author]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Author] -GO - -CREATE TABLE [Author] -( - [AuthorId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY - , [Lastname] VARCHAR(55) NOT NULL - , [Firstname] VARCHAR(25) NOT NULL -) -GO - -CREATE TABLE [Book] -( - [BookId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY - , [AuthorId] INT NOT NULL CONSTRAINT fk_Book_Author_AuthorId FOREIGN KEY ([AuthorId]) REFERENCES [Author]([AuthorId]) - , [Title] VARCHAR(55) NOT NULL -) -GO - -PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Author' -SET IDENTITY_INSERT [dbo].[Author] ON -INSERT INTO [Author] - ( - [AuthorId] - , [Lastname] - , [Firstname] - ) - SELECT 1, 'Brockey', 'Michael' UNION - SELECT 2, 'Buxton', 'Stevem' UNION - SELECT 3, 'Jones', 'Happy' UNION - SELECT 4, 'Smith', 'john' UNION - SELECT 5, 'Johnson', 'Todd' UNION - SELECT 6, 'Brockey', 'Michael' UNION - SELECT 7, 'Buxton', 'Stevem' UNION - SELECT 8, 'Jones', 'Happy' UNION - SELECT 9, 'Smith', 'john' UNION - SELECT 10, 'Johnson', 'Todd' UNION - SELECT 11, 'Brockey', 'Michael' UNION - SELECT 12, 'Buxton', 'Stevem' UNION - SELECT 13, 'Jones', 'Happy' UNION - SELECT 14, 'Smith', 'john' UNION - SELECT 15, 'Johnson', 'Todd' UNION - SELECT 16, 'Brockey', 'Michael' UNION - SELECT 17, 'Buxton', 'Stevem' UNION - SELECT 18, 'Jones', 'Happy' UNION - SELECT 19, 'Smith', 'john' UNION - SELECT 20, 'Johnson', 'Todd' UNION - SELECT 21, 'Brockey', 'Michael' UNION - SELECT 22, 'Buxton', 'Stevem' UNION - SELECT 23, 'Jones', 'Happy' UNION - SELECT 24, 'Smith', 'john' UNION - SELECT 25, 'Johnson', 'Todd' UNION - SELECT 26, 'Brockey', 'Michael' UNION - SELECT 27, 'Buxton', 'Stevem' UNION - SELECT 28, 'Jones', 'Happy' UNION - SELECT 29, 'Smith', 'john' UNION - SELECT 30, 'Johnson', 'Todd' UNION - SELECT 31, 'Brockey', 'Michael' UNION - SELECT 32, 'Buxton', 'Stevem' UNION - SELECT 33, 'Jones', 'Happy' UNION - SELECT 34, 'Smith', 'john' UNION - SELECT 35, 'Johnson', 'Todd' UNION - SELECT 36, 'Brockey', 'Michael' UNION - SELECT 37, 'Buxton', 'Stevem' UNION - SELECT 38, 'Jones', 'Happy' UNION - SELECT 39, 'Smith', 'john' UNION - SELECT 40, 'Johnson', 'Todd' UNION - SELECT 41, 'Brockey', 'Michael' UNION - SELECT 42, 'Buxton', 'Stevem' UNION - SELECT 43, 'Jones', 'Happy' UNION - SELECT 44, 'Smith', 'john' UNION - SELECT 45, 'Johnson', 'Todd' UNION - SELECT 46, 'Brockey', 'Michael' UNION - SELECT 47, 'Buxton', 'Stevem' UNION - SELECT 48, 'Jones', 'Happy' UNION - SELECT 49, 'Smith', 'john' UNION - SELECT 50, 'Johnson', 'Todd' -SET IDENTITY_INSERT [dbo].[Author] OFF -GO - -PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Book' -SET IDENTITY_INSERT [dbo].[Book] ON -INSERT INTO [Book] - ( - [BookId] - , [AuthorId] - , [Title] - ) - SELECT 1, 1, 'My First Book' UNION - SELECT 2, 1, 'My Second Book' UNION - SELECT 3, 2, 'My First Book' UNION - SELECT 4, 2, 'My Second Book' UNION - SELECT 5, 3, 'My First Book' UNION - SELECT 6, 4, 'My First Book' UNION - SELECT 7, 5, 'My First Book' UNION - SELECT 8, 2, 'My Second Book' UNION - SELECT 9, 3, 'My First Book' UNION - SELECT 10, 4, 'My First Book' UNION - SELECT 11, 1, 'My First Book' UNION - SELECT 12, 1, 'My Second Book' UNION - SELECT 13, 2, 'My First Book' UNION - SELECT 14, 2, 'My Second Book' UNION - SELECT 15, 3, 'My First Book' UNION - SELECT 16, 4, 'My First Book' UNION - SELECT 17, 5, 'My First Book' UNION - SELECT 18, 2, 'My Second Book' UNION - SELECT 19, 3, 'My First Book' UNION - SELECT 20, 4, 'My First Book' UNION - SELECT 21, 1, 'My First Book' UNION - SELECT 22, 1, 'My Second Book' UNION - SELECT 23, 2, 'My First Book' UNION - SELECT 24, 2, 'My Second Book' UNION - SELECT 25, 3, 'My First Book' UNION - SELECT 26, 4, 'My First Book' UNION - SELECT 27, 5, 'My First Book' UNION - SELECT 28, 2, 'My Second Book' UNION - SELECT 29, 3, 'My First Book' UNION - SELECT 30, 4, 'My First Book' UNION - SELECT 31, 1, 'My First Book' UNION - SELECT 32, 1, 'My Second Book' UNION - SELECT 33, 2, 'My First Book' UNION - SELECT 34, 2, 'My Second Book' UNION - SELECT 35, 3, 'My First Book' UNION - SELECT 36, 4, 'My First Book' UNION - SELECT 37, 5, 'My First Book' UNION - SELECT 38, 2, 'My Second Book' UNION - SELECT 39, 3, 'My First Book' UNION - SELECT 40, 4, 'My First Book' UNION - SELECT 41, 1, 'My First Book' UNION - SELECT 42, 1, 'My Second Book' UNION - SELECT 43, 2, 'My First Book' UNION - SELECT 44, 2, 'My Second Book' UNION - SELECT 45, 3, 'My First Book' UNION - SELECT 46, 4, 'My First Book' UNION - SELECT 47, 5, 'My First Book' UNION - SELECT 48, 2, 'My Second Book' UNION - SELECT 49, 3, 'My First Book' UNION - SELECT 50, 4, 'My First Book' UNION - SELECT 51, 1, 'My First Book' UNION - SELECT 52, 1, 'My Second Book' UNION - SELECT 53, 2, 'My First Book' UNION - SELECT 54, 2, 'My Second Book' UNION - SELECT 55, 3, 'My First Book' UNION - SELECT 56, 4, 'My First Book' UNION - SELECT 57, 5, 'My First Book' UNION - SELECT 58, 2, 'My Second Book' UNION - SELECT 59, 3, 'My First Book' UNION - SELECT 60, 4, 'My First Book' UNION - SELECT 61, 1, 'My First Book' UNION - SELECT 62, 1, 'My Second Book' UNION - SELECT 63, 2, 'My First Book' UNION - SELECT 64, 2, 'My Second Book' UNION - SELECT 65, 3, 'My First Book' UNION - SELECT 66, 4, 'My First Book' UNION - SELECT 67, 5, 'My First Book' UNION - SELECT 68, 2, 'My Second Book' UNION - SELECT 69, 3, 'My First Book' UNION - SELECT 70, 4, 'My First Book' UNION - SELECT 71, 1, 'My First Book' UNION - SELECT 72, 1, 'My Second Book' UNION - SELECT 73, 2, 'My First Book' UNION - SELECT 74, 2, 'My Second Book' UNION - SELECT 75, 3, 'My First Book' UNION - SELECT 76, 4, 'My First Book' UNION - SELECT 77, 5, 'My First Book' UNION - SELECT 78, 2, 'My Second Book' UNION - SELECT 79, 3, 'My First Book' UNION - SELECT 80, 4, 'My First Book' UNION - SELECT 81, 1, 'My First Book' UNION - SELECT 82, 1, 'My Second Book' UNION - SELECT 83, 2, 'My First Book' UNION - SELECT 84, 2, 'My Second Book' UNION - SELECT 85, 3, 'My First Book' UNION - SELECT 86, 4, 'My First Book' UNION - SELECT 87, 5, 'My First Book' UNION - SELECT 88, 2, 'My Second Book' UNION - SELECT 89, 3, 'My First Book' UNION - SELECT 90, 4, 'My First Book' UNION - SELECT 91, 1, 'My First Book' UNION - SELECT 92, 1, 'My Second Book' UNION - SELECT 93, 2, 'My First Book' UNION - SELECT 94, 2, 'My Second Book' UNION - SELECT 95, 3, 'My First Book' UNION - SELECT 96, 4, 'My First Book' UNION - SELECT 97, 5, 'My First Book' UNION - SELECT 98, 2, 'My Second Book' UNION - SELECT 99, 3, 'My First Book' - -SET IDENTITY_INSERT [dbo].[Book] OFF -GO - diff --git a/Backup/TestHarnessExample/Scripts/Prepare Database.bat b/Backup/TestHarnessExample/Scripts/Prepare Database.bat deleted file mode 100644 index 1f1e74f..0000000 --- a/Backup/TestHarnessExample/Scripts/Prepare Database.bat +++ /dev/null @@ -1,3 +0,0 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c PREPARE - -pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Refresh Database.bat b/Backup/TestHarnessExample/Scripts/Refresh Database.bat deleted file mode 100644 index 122dddb..0000000 --- a/Backup/TestHarnessExample/Scripts/Refresh Database.bat +++ /dev/null @@ -1,3 +0,0 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c REFRESH - -pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat b/Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat deleted file mode 100644 index 3a73942..0000000 --- a/Backup/TestHarnessExample/Scripts/Refresh Entire Database.bat +++ /dev/null @@ -1,3 +0,0 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c FORCEREFRESH - -pause \ No newline at end of file diff --git a/Backup/TestHarnessExample/TestFixtureBase.cs b/Backup/TestHarnessExample/TestFixtureBase.cs deleted file mode 100644 index a2b847c..0000000 --- a/Backup/TestHarnessExample/TestFixtureBase.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Data.SqlClient; -using DataFresh; -using NUnit.Framework; - -namespace TestHarnessExample -{ - public class TestFixtureBase - { - public static SqlDataFresh dataFresh = null; - public static string connectionString = "user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=(local);"; - - public TestFixtureBase() - { - if(dataFresh == null) - { - dataFresh = new SqlDataFresh(connectionString); - } - } - - [SetUp] - public void SetUp() - { - Console.Out.WriteLine("Setup"); - if (dataFresh.HasDatabaseBeenModified()) - { - dataFresh.RefreshTheDatabase(); - } - } - - [TearDown] - public void TearDown() - { - Console.Out.WriteLine("TearDown"); - if (dataFresh.HasDatabaseBeenModified()) - { - Console.Out.WriteLine("Database Write"); - } - } - - #region Data Access Helpers - - public static void ExecuteNonQuery(string sql) - { - using (SqlConnection conn = new SqlConnection(connectionString)) - { - SqlCommand cmd = new SqlCommand(sql, conn); - conn.Open(); - cmd.ExecuteNonQuery(); - } - } - - public static object ExecuteScalar(string sql) - { - using (SqlConnection conn = new SqlConnection(connectionString)) - { - SqlCommand cmd = new SqlCommand(sql, conn); - conn.Open(); - return cmd.ExecuteScalar(); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Backup/TestHarnessExample/TestHarnessExample.csproj b/Backup/TestHarnessExample/TestHarnessExample.csproj deleted file mode 100644 index ae24df0..0000000 --- a/Backup/TestHarnessExample/TestHarnessExample.csproj +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Backup/Testing.DataFresh/DataFreshConsoleTester.cs b/Backup/Testing.DataFresh/DataFreshConsoleTester.cs deleted file mode 100644 index 24c1728..0000000 --- a/Backup/Testing.DataFresh/DataFreshConsoleTester.cs +++ /dev/null @@ -1,116 +0,0 @@ -using DataFresh; -using NUnit.Framework; - -namespace Testing.DataFresh -{ - [TestFixture] - public class DataFreshConsoleTester - { - [SetUp] - public void Setup() - { - ExecuteDataFreshConsole("PREPARE"); - } - - [TearDown] - public void TearDown() - { - ExecuteDataFreshConsole("REMOVE"); - } - - [Test] - public void NoArgs() - { - string[] args = new string[] {}; - DataFreshConsole console = new DataFreshConsole(); - console.Start(args); - } - - [Test] - public void BlankArgs() - { - string[] args = new string[] {"", ""}; - DataFreshConsole console = new DataFreshConsole(); - console.Start(args); - } - - [Test] - public void BadCommand() - { - DataFreshConsole console = ExecuteDataFreshConsole("BADCOMMAND"); - Assert.IsTrue(console.Results.ToString().IndexOf("Command 'BADCOMMAND' was not recognized") > -1); - } - - [Test] - public void PrepareCommand() - { - DataFreshConsole console = ExecuteDataFreshConsole("PREPARE"); - } - - [Test] - public void PrepareCommandIgnoreSnapshot() - { - DataFreshConsole console = ExecuteDataFreshConsole("PREPARE", "-ignoresnapshot", "1"); - - } - - [Test] - public void RefreshCommand() - { - ExecuteDataFreshConsole("REFRESH"); - } - - [Test, ExpectedException(typeof (SqlDataFreshException))] - public void RefreshWithoutPrepareCommand() - { - ExecuteDataFreshConsole("REMOVE"); - ExecuteDataFreshConsole("REFRESH"); - } - - [Test] - public void CheckResults() - { - DataFreshConsole console = ExecuteDataFreshConsole("REFRESH"); - Assert.IsTrue(console.Results.ToString().IndexOf("Entropy Zero") > -1); - } - - [Test] - public void PassServerInstanceNameCheckConnectionString() - { - string serverInstance = @"localhost\dev"; - DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); - Assert.AreEqual(5, console.arguments.Keys.Count); - Assert.AreEqual(serverInstance, console.arguments["s"]); - string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost\dev;"; - Assert.AreEqual(expectedConnectionString, console.connectionString); - } - - [Test] - public void PassServerNameCheckConnectionString() - { - string serverInstance = @"localhost"; - DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); - Assert.AreEqual(5, console.arguments.Keys.Count); - Assert.AreEqual(serverInstance, console.arguments["s"]); - string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost;"; - Assert.AreEqual(expectedConnectionString, console.connectionString); - } - - [Test] - public void CheckSnapshotPath() - { - //-sp "${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData"" - //-sp '${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData' - string snapshotPath = @"c:\temp"; - DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", "localhost", "DataFreshSample", "-sp", snapshotPath); - Assert.AreEqual(6, console.arguments.Keys.Count); - Assert.AreEqual(snapshotPath, console.arguments["sp"]); - } - - private static DataFreshConsole ExecuteDataFreshConsole(string command, params string[] options) - { - DataFreshConsole console = DataFreshConsole.Execute(command, "test", "test", "localhost", "DataFreshSample", options); - return console; - } - } -} \ No newline at end of file diff --git a/Backup/Testing.DataFresh/Database Files/Database.sql b/Backup/Testing.DataFresh/Database Files/Database.sql deleted file mode 100644 index 838d2aa..0000000 --- a/Backup/Testing.DataFresh/Database Files/Database.sql +++ /dev/null @@ -1,67 +0,0 @@ -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Book]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Book] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Author]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Author] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Movie]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Movie] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Movie2]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Movie2] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Check]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Check] -GO - -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Check Table With Spaces]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) -drop table [dbo].[Check Table With Spaces] -GO - -CREATE TABLE [Author] -( - [AuthorId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY - , [Lastname] VARCHAR(55) NOT NULL - , [Firstname] VARCHAR(25) NOT NULL -) -GO - -CREATE TABLE [Book] -( - [BookId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY - , [AuthorId] INT NOT NULL CONSTRAINT fk_Book_Author_AuthorId FOREIGN KEY ([AuthorId]) REFERENCES [Author]([AuthorId]) - , [Title] VARCHAR(55) NOT NULL -) -GO - -CREATE TABLE [Movie] -( - [MovieId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY - , [Title] VARCHAR(55) NOT NULL -) -GO - -CREATE TABLE [Movie2] -( - [MovieId] INT NOT NULL PRIMARY KEY - , [Title] VARCHAR(55) NOT NULL -) -GO - -CREATE TABLE [Check] -( - [MovieId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY - , [Title] VARCHAR(55) NOT NULL -) -GO - -CREATE TABLE [Check Table With Spaces] -( - [MovieId] INT IDENTITY(1,1) NOT NULL PRIMARY KEY - , [Title] VARCHAR(55) NOT NULL -) -GO \ No newline at end of file diff --git a/Backup/Testing.DataFresh/Database Files/Deltas/PlaceHolder.txt b/Backup/Testing.DataFresh/Database Files/Deltas/PlaceHolder.txt deleted file mode 100644 index e69de29..0000000 diff --git a/Backup/Testing.DataFresh/Database Files/Setup.sql b/Backup/Testing.DataFresh/Database Files/Setup.sql deleted file mode 100644 index 0b7c1ec..0000000 --- a/Backup/Testing.DataFresh/Database Files/Setup.sql +++ /dev/null @@ -1,44 +0,0 @@ -if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[df_Setup]') and OBJECTPROPERTY(id, N'IsProcedure') = 1) -drop procedure [dbo].[df_Setup] -GO - -CREATE PROCEDURE [dbo].[df_Setup] -AS - DELETE BOOK - DELETE AUTHOR - - PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Author' - SET IDENTITY_INSERT [dbo].[Author] ON - INSERT INTO [Author] - ( - [AuthorId] - , [Lastname] - , [Firstname] - ) - SELECT 1, 'Brockey', 'Michael' UNION - SELECT 2, 'Buxton', 'Stevem' UNION - SELECT 3, 'Jones', 'Happy' UNION - SELECT 4, 'Smith', 'john' UNION - SELECT 5, 'Johnson', 'Todd' - SET IDENTITY_INSERT [dbo].[Author] OFF - - PRINT CAST(CURRENT_TIMESTAMP AS VARCHAR(30)) + ': Inserting Book' - SET IDENTITY_INSERT [dbo].[Book] ON - INSERT INTO [Book] - ( - [BookId] - , [AuthorId] - , [Title] - ) - SELECT 1, 1, 'My First Book' UNION - SELECT 2, 1, 'My Second Book' UNION - SELECT 3, 2, 'My First Book' UNION - SELECT 4, 2, 'My Second Book' UNION - SELECT 5, 3, 'My First Book' UNION - SELECT 6, 4, 'My First Book' UNION - SELECT 7, 5, 'My First Book' - SET IDENTITY_INSERT [dbo].[Book] OFF -GO - -EXEC df_SETUP -go diff --git a/Backup/Testing.DataFresh/SqlDataFreshTester.cs b/Backup/Testing.DataFresh/SqlDataFreshTester.cs deleted file mode 100644 index dd1e243..0000000 --- a/Backup/Testing.DataFresh/SqlDataFreshTester.cs +++ /dev/null @@ -1,325 +0,0 @@ -using System; -using System.IO; -using DataFresh; -using EntropyZero.deltaRunner; -using NUnit.Framework; - -namespace Testing.DataFresh -{ - [TestFixture] - public class SqlDataFreshTester : TestFixtureBase - { - [Test, ExpectedException(typeof (InvalidOperationException), "The ConnectionString property has not been initialized.")] - public void PrepDatabaseforDataFresh_NoConnectionString() - { - SqlDataFresh dataFresh = new SqlDataFresh(null); - dataFresh.PrepareDatabaseforDataFresh(); - } - - [Test] - public void Encrypt() - { -// string key = "pass@word1"; -// -// string enc = ResourceManagement.Encrypt("test", key); -// Assert.AreEqual("test", ResourceManagement.Decrypt(enc, key)); - -// ResourceManagement.Encrypt(@"C:\development\dataFresh\DataFresh\Resources\PrepareDataFresh.sql", -// @"C:\development\dataFresh\DataFresh\Resources\PrepareDataFresh.sql.enc", key); - -// byte[] dec = ResourceManagement.GetDecryptedResourceBytes("DataFresh.Resources.PrepareDataFresh.sql.enc"); -// string decStr = System.Text.Encoding.ASCII.GetString(dec); -// Console.Out.WriteLine("decStr = {0}", decStr); - -// string str = ResourceManagement.GetDecryptedResource("DataFresh.Resources.PrepareDataFresh.sql"); -// Console.Out.WriteLine("str = {0}", str); - } - - [Test] - public void RemoveDataFresh() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - - dataFresh.RemoveDataFreshFromDatabase(); - Assert.IsFalse(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); - } - - [Test] - public void PrepDatabaseforDataFresh() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - - dataFresh.RemoveDataFreshFromDatabase(); - Assert.IsFalse(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); - - dataFresh.PrepareDatabaseforDataFresh(); - Assert.IsTrue(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); - } - - [Test] - public void SnapshopPath_ManualOverride() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - DirectoryInfo tempPath = new DirectoryInfo(Path.GetTempPath()); - dataFresh.SnapshotPath = tempPath; - Console.Out.WriteLine("dataFresh.SnapshotPath.FullName = {0}", dataFresh.SnapshotPath.FullName); - Assert.AreEqual(tempPath.FullName, dataFresh.SnapshotPath.FullName); - } - - [Test] - public void SnapshopPath_ManualOverrideTrailingBackslash() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - string tempPath = @"c:\temp\folder"; - dataFresh.SnapshotPath = new DirectoryInfo(tempPath); - Assert.AreEqual(@"c:\temp\folder\", dataFresh.SnapshotPath.FullName); - } - - [Test] - public void SnapshopPath_Resetting() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.SnapshotPath = null; - Assert.IsTrue(dataFresh.SnapshotPath.FullName.IndexOf("Snapshot_DataFreshSample") > -1); - } - - [Test] - public void SnapshopPath() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - Assert.IsTrue(dataFresh.SnapshotPath.FullName.IndexOf("Snapshot_DataFreshSample") > -1); - } - - [Test] - public void IdentityReseedDuringRefresh() - { - InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.PrepareDatabaseforDataFresh(true); - int id = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); - Assert.AreEqual(6, id); - dataFresh.RefreshTheDatabase(); - int id2 = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); - Assert.AreEqual(6, id2); - } - - [Test] - public void IdentityReseedDuringRefresh_TableWithNoRows() - { - InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.PrepareDatabaseforDataFresh(true); - int id = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); - Assert.AreEqual(1, id); - dataFresh.RefreshTheDatabase(); - int id2 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); - Assert.AreEqual(1, id2); - int id3 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world 2'); select @@identity;")); - Assert.AreEqual(2, id3); - } - - [Test] - public void IdentityReseedDuringRefresh_TableWithNoRows2() - { - InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); - ExecuteNonQuery("insert into movie2 (movieid, title) values (1, 'mike brockey takes over the world');"); - dataFresh.RefreshTheDatabase(); - } - - [Test] - public void IdentityReseedWorksWithTablesThatUseReservedWords() - { - InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); - ExecuteNonQuery("insert into [check] (title) values ('mike brockey takes over the world');"); - dataFresh.RefreshTheDatabase(); - } - - [Test] - public void RefreshTheDatabaseSpeedTests() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString, true); - dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); - } - - [Test] - public void ShouldNotRefreshDeltaRunnerTable() - { - InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); - ExecuteNonQuery("insert into [dr_deltaversion] ([latestdelta], [hash], [filename]) values (99, 'blah-hash', 'whatever file');"); - Assert.AreEqual(1, ExecuteScalar("select count(*) from [dr_deltaversion] where [filename] = 'whatever file'")); - dataFresh.RefreshTheDatabase(); - Assert.AreEqual(1, ExecuteScalar("select count(*) from [dr_deltaversion] where [filename] = 'whatever file'")); - } - - private void InitializeTheDatabase() - { - SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, new DirectoryInfo(deltaPath).FullName, true); - deltaRunner.PrepareForDeltaRunner(); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "Database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "Setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); - deltaRunner.ApplyDeltas(); - } - } -} \ No newline at end of file diff --git a/Backup/Testing.DataFresh/TestFixtureBase.cs b/Backup/Testing.DataFresh/TestFixtureBase.cs deleted file mode 100644 index 8d4d218..0000000 --- a/Backup/Testing.DataFresh/TestFixtureBase.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Data.SqlClient; -using System.IO; -using EntropyZero.deltaRunner; -using NUnit.Framework; - -namespace Testing.DataFresh -{ - public class TestFixtureBase - { - public static string connectionString = "user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=(local);pooling=false;"; - public static string connectionStringMaster = "user id=test;password=test;Initial Catalog=Master;Data Source=(local);pooling=false;"; - public static string databaseFilesPath = @"..\..\Database Files\"; - public static string deltaPath = @"..\..\Database Files\Deltas"; - - [SetUp] - public void SetUp() - { - SqlDeltaRunner.CreateDatabase("DataFreshSample", connectionStringMaster, true); - DeltaRunnerInstance.ApplyDeltas(); - } - - public SqlDeltaRunner DeltaRunnerInstance - { - get - { - SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, deltaPath, true); - deltaRunner.PrepareForDeltaRunner(); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); - return deltaRunner; - } - } - - public void ExecuteNonQuery(string sql) - { - using (SqlConnection conn = new SqlConnection(connectionString)) - { - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; - conn.Open(); - cmd.ExecuteNonQuery(); - } - } - - public object ExecuteScalar(string sql) - { - using (SqlConnection conn = new SqlConnection(connectionString)) - { - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; - conn.Open(); - return cmd.ExecuteScalar(); - } - } - } -} \ No newline at end of file diff --git a/Backup/Testing.DataFresh/Testing.DataFresh.csproj b/Backup/Testing.DataFresh/Testing.DataFresh.csproj deleted file mode 100644 index c344754..0000000 --- a/Backup/Testing.DataFresh/Testing.DataFresh.csproj +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DataFresh/AssemblyResourceEncrpytion.cs b/DataFresh/AssemblyResourceEncrpytion.cs new file mode 100644 index 0000000..8962c54 --- /dev/null +++ b/DataFresh/AssemblyResourceEncrpytion.cs @@ -0,0 +1,41 @@ +using System; + +namespace DataFresh +{ + [AttributeUsage(AttributeTargets.Assembly)] + public class AssemblyResourceEncrpytion : Attribute + { + private bool enryptionEnabled; + private string enryptionKey = "nopassword"; + + public AssemblyResourceEncrpytion() + { + enryptionEnabled = true; + } + + public AssemblyResourceEncrpytion(bool enabled) + { + enryptionEnabled = enabled; + } + + public virtual bool Enabled + { + get + { + return enryptionEnabled; + } + set + { + enryptionEnabled = value; + } + } + + public virtual string Key + { + get + { + return enryptionKey; + } + } + } +} \ No newline at end of file diff --git a/UpgradeLog.htm b/UpgradeLog.htm deleted file mode 100644 index bec75c8387b9423e0f3b84b5e5965ee54607b2c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 84806 zcmeI5`F9gZlE>@U-S_5y(7;YZFYO!5(L>Mk3C3XXfoT}`n`eCE6U!$vvw!;Te!dw_ zvZ^GNs$@%+O+7tZs;bP$h{(vu$cV_S|NGy+Mt_dRqqosmv=Dua-bE8pCEARRqTOgG z`YrlX^q-MR^zf-f)o3|7iPoZ3ey>M|(LSXr(J{YvqUX{5sGrY3^f3CFa-Vs644h}t zR+o0x6O}dW^#3_!*SPMXy(+(r6Gzbjch;h> z+}(nHl^RRb>xo_idoS9c#4`WaT;0B=ZHX&qwA=Tc2fsR;Hi2>o2IAIpU>-qP51bt? zgwsNF4(4%Oj==v2j;_(lKlt8<{waDtP^8{f%Uh1VIj#=)bx5s#+V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put schema on first place to keep consistency. --- DataFresh/Resources/PrepareDataFresh.sql | 74 ++++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/DataFresh/Resources/PrepareDataFresh.sql b/DataFresh/Resources/PrepareDataFresh.sql index 5491448..bad41dd 100644 --- a/DataFresh/Resources/PrepareDataFresh.sql +++ b/DataFresh/Resources/PrepareDataFresh.sql @@ -24,8 +24,8 @@ GO CREATE TABLE [dbo].[df_ChangeTracking] ( - [TABLENAME] sysname, - [TABLESCHEMA] sysname + [TABLESCHEMA] sysname, + [TABLENAME] sysname ) GO @@ -35,20 +35,20 @@ CREATE PROCEDURE dbo.[df_ChangedTableDataRefresh] ) AS - DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) + DECLARE @sql NVARCHAR(4000) DECLARE @TableSchema VARCHAR(255) + DECLARE @TableName VARCHAR(255) - SELECT DISTINCT TableName, TableSchema INTO #ChangedTables FROM df_ChangeTracking + SELECT DISTINCT TableSchema, TableName INTO #ChangedTables FROM df_ChangeTracking TRUNCATE TABLE df_ChangeTracking DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tablename], [tableschema] from #ChangedTables + SELECT [tableschema], [tablename] from #ChangedTables UNION - SELECT DISTINCT - OBJECT_NAME(fkeyid) AS Referenced_Table_Name, - OBJECT_SCHEMA_NAME(fkeyid) AS Referenced_Table_Schema + SELECT DISTINCT + OBJECT_SCHEMA_NAME(fkeyid) AS Referenced_Table_Schema, + OBJECT_NAME(fkeyid) AS Referenced_Table_Name FROM sysreferences sr INNER JOIN #ChangedTables ct ON sr.rkeyid = OBJECT_ID(ct.tablename) @@ -56,22 +56,22 @@ AS OPEN Table_Cursor -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] NOCHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName END -- Delete All data from Changed Tables and Refill DECLARE ChangedTable_Cursor CURSOR FOR - SELECT [tablename], [tableschema] FROM #ChangedTables WHERE tablename not in('df_ChangeTracking', 'dr_DeltaVersion') + SELECT [tableschema], [tablename] FROM #ChangedTables WHERE tablename not in('df_ChangeTracking', 'dr_DeltaVersion') OPEN ChangedTable_Cursor - FETCH NEXT FROM ChangedTable_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM ChangedTable_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN PRINT @TableName @@ -96,19 +96,19 @@ AS )' EXEC sp_executesql @sql - FETCH NEXT FROM ChangedTable_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM ChangedTable_Cursor INTO @TableSchema, @TableName END CLOSE ChangedTable_Cursor DEALLOCATE ChangedTable_Cursor -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableName, @TableSchema + FETCH FIRST FROM Table_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] CHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName END CLOSE Table_Cursor DEALLOCATE Table_Cursor @@ -121,19 +121,19 @@ AS IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) CREATE TABLE [df_ChangeTracking] ( - [TABLENAME] sysname, - [TABLESCHEMA] sysname + [TABLESCHEMA] sysname, + [TABLENAME] sysname ) DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) DECLARE @TableSchema VARCHAR(255) + DECLARE @TableName VARCHAR(255) DECLARE Table_Cursor CURSOR FOR - SELECT [table_name], [table_schema] FROM information_schema.tables WHERE table_type = 'BASE TABLE' + SELECT [table_schema], [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN @@ -144,12 +144,12 @@ AS SET @sql = N'CREATE TRIGGER [' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + '] on [' + @TableSchema + '].[' + @TableName + '] for insert, update, delete as SET NOCOUNT ON - INSERT INTO df_ChangeTracking (tablename, tableschema) VALUES (''' + @TableName + ''', ''' + @TableSchema + ''') + INSERT INTO df_ChangeTracking (tableschema, tablename) VALUES (''' + @TableSchema + ''', ''' + @TableName + ''') SET NOCOUNT OFF' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName END CLOSE Table_Cursor @@ -194,34 +194,34 @@ CREATE PROCEDURE dbo.[df_TableDataImport] AS DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) DECLARE @TableSchema VARCHAR(255) + DECLARE @TableName VARCHAR(255) - SELECT Table_Name as TableName, Table_Schema as TableSchema INTO #UserTables FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' + SELECT Table_Schema as TableSchema, Table_Name as TableName INTO #UserTables FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tablename], [tableschema] FROM #UserTables + SELECT [tableschema], [tablename] FROM #UserTables OPEN Table_Cursor -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] NOCHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName END -- Delete All data from Changed Tables and Refill DECLARE UserTable_Cursor CURSOR FOR - SELECT [tablename], [tableschema] FROM #UserTables WHERE tablename not in ('df_ChangeTracking', 'dr_DeltaVersion') and tableschema <> 'dbo' + SELECT [tableschema], [tablename] FROM #UserTables WHERE tablename not in ('df_ChangeTracking', 'dr_DeltaVersion') OPEN UserTable_Cursor - FETCH NEXT FROM UserTable_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM UserTable_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN PRINT @TableSchema + '.' + @TableName @@ -238,20 +238,20 @@ AS )' EXEC sp_executesql @sql - FETCH NEXT FROM UserTable_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM UserTable_Cursor INTO @TableSchema, @TableName END CLOSE UserTable_Cursor DEALLOCATE UserTable_Cursor -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableName, @TableSchema + FETCH FIRST FROM Table_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] CHECK CONSTRAINT ALL' EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName END CLOSE Table_Cursor @@ -262,14 +262,14 @@ GO CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerRemove] AS DECLARE @sql NVARCHAR(4000) - DECLARE @TableName VARCHAR(255) DECLARE @TableSchema VARCHAR(255) + DECLARE @TableName VARCHAR(255) DECLARE Table_Cursor CURSOR FOR - SELECT [table_name], [table_schema] FROM information_schema.tables WHERE table_type = 'BASE TABLE' + SELECT [table_schema], [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName WHILE (@@Fetch_Status = 0) BEGIN @@ -278,7 +278,7 @@ AS EXEC sp_executesql @sql - FETCH NEXT FROM Table_Cursor INTO @TableName, @TableSchema + FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName END CLOSE Table_Cursor From f08a98e4d7bf6ec884b1b777ee5c0a6e37e79442 Mon Sep 17 00:00:00 2001 From: Vladyslav Danylov Date: Wed, 20 Jul 2016 12:13:47 +0300 Subject: [PATCH 05/13] Removed AssemblyResourceEncrpytion.cs --- DataFresh/AssemblyResourceEncrpytion.cs | 41 ------------------------- 1 file changed, 41 deletions(-) delete mode 100644 DataFresh/AssemblyResourceEncrpytion.cs diff --git a/DataFresh/AssemblyResourceEncrpytion.cs b/DataFresh/AssemblyResourceEncrpytion.cs deleted file mode 100644 index 8962c54..0000000 --- a/DataFresh/AssemblyResourceEncrpytion.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; - -namespace DataFresh -{ - [AttributeUsage(AttributeTargets.Assembly)] - public class AssemblyResourceEncrpytion : Attribute - { - private bool enryptionEnabled; - private string enryptionKey = "nopassword"; - - public AssemblyResourceEncrpytion() - { - enryptionEnabled = true; - } - - public AssemblyResourceEncrpytion(bool enabled) - { - enryptionEnabled = enabled; - } - - public virtual bool Enabled - { - get - { - return enryptionEnabled; - } - set - { - enryptionEnabled = value; - } - } - - public virtual string Key - { - get - { - return enryptionKey; - } - } - } -} \ No newline at end of file From 660dc4de78d0072559ef1eb98fb64960491c5e98 Mon Sep 17 00:00:00 2001 From: Vladyslav Danylov Date: Thu, 21 Jul 2016 11:02:12 +0300 Subject: [PATCH 06/13] Added proper gitignore file. --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 6f27111..b4be0b9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,6 @@ obj _ReSharper* *.user *.suo -*.resharper* \ No newline at end of file +*.resharper* +Output/ +[Pp]ackages/* \ No newline at end of file From 1b287511c4fdfef73bd248343e055cf35f532eb5 Mon Sep 17 00:00:00 2001 From: Jorre Meijrink Date: Tue, 30 Apr 2019 09:40:49 +0200 Subject: [PATCH 07/13] [DEVLEAD-2984] Upgrade DataFresh to dotnet 472 --- DataFresh.Common/DataFresh.Common.csproj | 5 ++- DataFresh/DataFresh.csproj | 5 ++- DataFreshUtil/DataFreshUtil.csproj | 8 ++++- DataFreshUtil/app.config | 3 ++ TestConnectionStrings.xml | 10 ++++++ .../Scripts/Prepare Database.bat | 2 +- TestHarnessExample/TestFixtureBase.cs | 21 +++++++++--- TestHarnessExample/TestHarnessExample.csproj | 22 ++++++++++--- TestHarnessExample/packages.config | 5 +++ Testing.DataFresh/DataFreshConsoleTester.cs | 31 +++++++++++++---- Testing.DataFresh/SqlDataFreshTester.cs | 11 ++++--- Testing.DataFresh/TestFixtureBase.cs | 33 +++++++++++++++---- Testing.DataFresh/Testing.DataFresh.csproj | 24 +++++++++++--- Testing.DataFresh/packages.config | 5 +++ 14 files changed, 149 insertions(+), 36 deletions(-) create mode 100644 DataFreshUtil/app.config create mode 100644 TestConnectionStrings.xml create mode 100644 TestHarnessExample/packages.config create mode 100644 Testing.DataFresh/packages.config diff --git a/DataFresh.Common/DataFresh.Common.csproj b/DataFresh.Common/DataFresh.Common.csproj index 5dce723..0f28634 100644 --- a/DataFresh.Common/DataFresh.Common.csproj +++ b/DataFresh.Common/DataFresh.Common.csproj @@ -21,10 +21,11 @@ - v2.0 + v4.7.2 0.0 + bin\Debug\ @@ -45,6 +46,7 @@ 4 full prompt + false bin\Release\ @@ -65,6 +67,7 @@ 4 none prompt + false diff --git a/DataFresh/DataFresh.csproj b/DataFresh/DataFresh.csproj index 2a914b4..b68ff65 100644 --- a/DataFresh/DataFresh.csproj +++ b/DataFresh/DataFresh.csproj @@ -21,10 +21,11 @@ - v2.0 + v4.7.2 0.0 + bin\Debug\ @@ -45,6 +46,7 @@ 4 full prompt + false bin\Release\ @@ -65,6 +67,7 @@ 4 full prompt + false diff --git a/DataFreshUtil/DataFreshUtil.csproj b/DataFreshUtil/DataFreshUtil.csproj index 0b424a0..d2d5664 100644 --- a/DataFreshUtil/DataFreshUtil.csproj +++ b/DataFreshUtil/DataFreshUtil.csproj @@ -21,10 +21,11 @@ - v2.0 + v4.7.2 0.0 + bin\Debug\ @@ -45,6 +46,7 @@ 4 full prompt + false bin\Release\ @@ -65,6 +67,7 @@ 4 none prompt + false @@ -91,6 +94,9 @@ + + + diff --git a/DataFreshUtil/app.config b/DataFreshUtil/app.config new file mode 100644 index 0000000..05d8b24 --- /dev/null +++ b/DataFreshUtil/app.config @@ -0,0 +1,3 @@ + + + diff --git a/TestConnectionStrings.xml b/TestConnectionStrings.xml new file mode 100644 index 0000000..2c8c781 --- /dev/null +++ b/TestConnectionStrings.xml @@ -0,0 +1,10 @@ + + + tf_user + 1234 + 172.17.159.185 + false + + user id={0};password={1};Initial Catalog=master;Server={2};pooling={3}; + user id={0};password={1};Initial Catalog=DataFreshSample;Server={2};pooling={3}; + \ No newline at end of file diff --git a/TestHarnessExample/Scripts/Prepare Database.bat b/TestHarnessExample/Scripts/Prepare Database.bat index 1f1e74f..7e4acf0 100644 --- a/TestHarnessExample/Scripts/Prepare Database.bat +++ b/TestHarnessExample/Scripts/Prepare Database.bat @@ -1,3 +1,3 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c PREPARE +DataFreshUtil.exe -s 172.17.159.185 -u tf_user -p 1234 -d DataFreshSample -c PREPARE pause \ No newline at end of file diff --git a/TestHarnessExample/TestFixtureBase.cs b/TestHarnessExample/TestFixtureBase.cs index a2b847c..9f466d1 100644 --- a/TestHarnessExample/TestFixtureBase.cs +++ b/TestHarnessExample/TestFixtureBase.cs @@ -1,18 +1,29 @@ using System; using System.Data.SqlClient; +using System.Xml; using DataFresh; using NUnit.Framework; +using System.IO; namespace TestHarnessExample { public class TestFixtureBase { - public static SqlDataFresh dataFresh = null; - public static string connectionString = "user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=(local);"; + public static SqlDataFresh dataFresh = null; + public readonly string connectionString; public TestFixtureBase() { - if(dataFresh == null) + var doc = new XmlDocument(); + doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), @"..\..\..\TestConnectionStrings.xml")); + connectionString = + String.Format(doc.SelectSingleNode("/connectionStrings/sqlDataFreshSampleConnectionStringTemplate").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/password").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/server").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/pooling").InnerText); + + if (dataFresh == null) { dataFresh = new SqlDataFresh(connectionString); } @@ -40,7 +51,7 @@ public void TearDown() #region Data Access Helpers - public static void ExecuteNonQuery(string sql) + public void ExecuteNonQuery(string sql) { using (SqlConnection conn = new SqlConnection(connectionString)) { @@ -50,7 +61,7 @@ public static void ExecuteNonQuery(string sql) } } - public static object ExecuteScalar(string sql) + public object ExecuteScalar(string sql) { using (SqlConnection conn = new SqlConnection(connectionString)) { diff --git a/TestHarnessExample/TestHarnessExample.csproj b/TestHarnessExample/TestHarnessExample.csproj index fdf8f6a..3f582c8 100644 --- a/TestHarnessExample/TestHarnessExample.csproj +++ b/TestHarnessExample/TestHarnessExample.csproj @@ -1,5 +1,7 @@  + + Local 7.10.3077 @@ -21,10 +23,13 @@ - v2.0 + v4.7.2 0.0 + + + bin\Debug\ @@ -45,6 +50,7 @@ 4 full prompt + false bin\Release\ @@ -65,6 +71,7 @@ 4 full prompt + false @@ -72,9 +79,8 @@ {05438358-2120-4D97-974E-ACF80F7EA6F7} {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - - nunit.framework - ..\DataFresh.Common\Assemblies\nunit.framework.dll + + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll System @@ -97,6 +103,7 @@ Code + @@ -110,4 +117,11 @@ + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/TestHarnessExample/packages.config b/TestHarnessExample/packages.config new file mode 100644 index 0000000..247616d --- /dev/null +++ b/TestHarnessExample/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Testing.DataFresh/DataFreshConsoleTester.cs b/Testing.DataFresh/DataFreshConsoleTester.cs index 24c1728..4045ef8 100644 --- a/Testing.DataFresh/DataFreshConsoleTester.cs +++ b/Testing.DataFresh/DataFreshConsoleTester.cs @@ -1,12 +1,29 @@ using DataFresh; using NUnit.Framework; - +using System.IO; + namespace Testing.DataFresh { [TestFixture] public class DataFreshConsoleTester { - [SetUp] + readonly string userId; + readonly string password; + readonly string server; + + public DataFreshConsoleTester() + { + var doc = new System.Xml.XmlDocument(); + doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), @"..\..\..\TestConnectionStrings.xml")); + //connectionString = connectionString = + // string.Format(doc.SelectSingleNode("/connectionStrings/sqlDataFreshSampleConnectionStringTemplate").InnerText, + userId = doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText; + password = doc.SelectSingleNode("/connectionStrings/properties/password").InnerText; + server = doc.SelectSingleNode("/connectionStrings/properties/server").InnerText; + //doc.SelectSingleNode("/connectionStrings/properties/pooling").InnerText); + } + + [SetUp] public void Setup() { ExecuteDataFreshConsole("PREPARE"); @@ -60,11 +77,11 @@ public void RefreshCommand() ExecuteDataFreshConsole("REFRESH"); } - [Test, ExpectedException(typeof (SqlDataFreshException))] + [Test] public void RefreshWithoutPrepareCommand() { - ExecuteDataFreshConsole("REMOVE"); - ExecuteDataFreshConsole("REFRESH"); + ExecuteDataFreshConsole("REMOVE"); + Assert.Throws(() => ExecuteDataFreshConsole("REFRESH")); } [Test] @@ -107,9 +124,9 @@ public void CheckSnapshotPath() Assert.AreEqual(snapshotPath, console.arguments["sp"]); } - private static DataFreshConsole ExecuteDataFreshConsole(string command, params string[] options) + private DataFreshConsole ExecuteDataFreshConsole(string command, params string[] options) { - DataFreshConsole console = DataFreshConsole.Execute(command, "test", "test", "localhost", "DataFreshSample", options); + DataFreshConsole console = DataFreshConsole.Execute(command, userId, password, server, "DataFreshSample", options); return console; } } diff --git a/Testing.DataFresh/SqlDataFreshTester.cs b/Testing.DataFresh/SqlDataFreshTester.cs index dd1e243..402f645 100644 --- a/Testing.DataFresh/SqlDataFreshTester.cs +++ b/Testing.DataFresh/SqlDataFreshTester.cs @@ -9,11 +9,11 @@ namespace Testing.DataFresh [TestFixture] public class SqlDataFreshTester : TestFixtureBase { - [Test, ExpectedException(typeof (InvalidOperationException), "The ConnectionString property has not been initialized.")] + [Test] public void PrepDatabaseforDataFresh_NoConnectionString() { SqlDataFresh dataFresh = new SqlDataFresh(null); - dataFresh.PrepareDatabaseforDataFresh(); + Assert.Throws(() => dataFresh.PrepareDatabaseforDataFresh(), "The ConnectionString property has not been initialized."); } [Test] @@ -315,10 +315,11 @@ public void ShouldNotRefreshDeltaRunnerTable() private void InitializeTheDatabase() { - SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, new DirectoryInfo(deltaPath).FullName, true); + var binDir = Path.GetDirectoryName(GetType().Assembly.Location); + SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, Path.Combine(binDir, deltaPath), true); deltaRunner.PrepareForDeltaRunner(); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "Database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "Setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "Database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "Setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); deltaRunner.ApplyDeltas(); } } diff --git a/Testing.DataFresh/TestFixtureBase.cs b/Testing.DataFresh/TestFixtureBase.cs index 8d4d218..41e1f3e 100644 --- a/Testing.DataFresh/TestFixtureBase.cs +++ b/Testing.DataFresh/TestFixtureBase.cs @@ -7,12 +7,30 @@ namespace Testing.DataFresh { public class TestFixtureBase { - public static string connectionString = "user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=(local);pooling=false;"; - public static string connectionStringMaster = "user id=test;password=test;Initial Catalog=Master;Data Source=(local);pooling=false;"; - public static string databaseFilesPath = @"..\..\Database Files\"; + public readonly string connectionString; + public readonly string connectionStringMaster; + public static string databaseFilesPath = @"..\..\Database Files"; public static string deltaPath = @"..\..\Database Files\Deltas"; - [SetUp] + public TestFixtureBase() + { + var doc = new System.Xml.XmlDocument(); + doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), @"..\..\..\TestConnectionStrings.xml")); + connectionString = connectionString = + string.Format(doc.SelectSingleNode("/connectionStrings/sqlDataFreshSampleConnectionStringTemplate").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/password").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/server").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/pooling").InnerText); + connectionStringMaster = + string.Format(doc.SelectSingleNode("/connectionStrings/sqlMasterDatabaseConnectionStringTemplate").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/password").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/server").InnerText, + doc.SelectSingleNode("/connectionStrings/properties/pooling").InnerText); + } + + [SetUp] public void SetUp() { SqlDeltaRunner.CreateDatabase("DataFreshSample", connectionStringMaster, true); @@ -23,10 +41,11 @@ public SqlDeltaRunner DeltaRunnerInstance { get { - SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, deltaPath, true); + var binDir = Path.GetDirectoryName(GetType().Assembly.Location); + SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, Path.Combine(binDir, deltaPath), true); deltaRunner.PrepareForDeltaRunner(); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(databaseFilesPath, "setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); return deltaRunner; } } diff --git a/Testing.DataFresh/Testing.DataFresh.csproj b/Testing.DataFresh/Testing.DataFresh.csproj index 3cb0ad3..b76389b 100644 --- a/Testing.DataFresh/Testing.DataFresh.csproj +++ b/Testing.DataFresh/Testing.DataFresh.csproj @@ -1,5 +1,7 @@  + + Local 7.10.6030 @@ -21,10 +23,13 @@ - v2.0 + v4.7.2 0.0 + + + bin\Debug\ @@ -45,6 +50,7 @@ 4 full prompt + false bin\Release\ @@ -65,6 +71,7 @@ 4 full prompt + false @@ -76,9 +83,8 @@ deltaRunner ..\DataFresh.Common\Assemblies\deltaRunner.dll - - nunit.framework - ..\DataFresh.Common\Assemblies\nunit.framework.dll + + ..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll System @@ -104,9 +110,19 @@ + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/Testing.DataFresh/packages.config b/Testing.DataFresh/packages.config new file mode 100644 index 0000000..247616d --- /dev/null +++ b/Testing.DataFresh/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file From d327b77ec1f9ec177a0f105d84d33d5dd732b0c8 Mon Sep 17 00:00:00 2001 From: Jorre Meijrink Date: Tue, 30 Apr 2019 11:49:49 +0200 Subject: [PATCH 08/13] [DEVLEAD-2984] Remove _Udpate to VS2018!_ from todo.txt --- TODO.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/TODO.txt b/TODO.txt index 3a02287..eb824c4 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,3 +1,2 @@ 1) Fix unit tests to create DatafreshSample DB automatically -2) Clean up scripts in Sample Project -3) Update to VS2008! \ No newline at end of file +2) Clean up scripts in Sample Project \ No newline at end of file From 12ee593718babd4a05028df9c83fd3d41f58d1bc Mon Sep 17 00:00:00 2001 From: Jorre Meijrink Date: Tue, 30 Apr 2019 12:17:23 +0200 Subject: [PATCH 09/13] [DEVLEAD-2984] Rename batch files to ps1. --- .../Scripts/{Clean Database.bat => Clean Database.ps1} | 0 .../Scripts/{Create Database.bat => Create Database.ps1} | 0 .../Scripts/{Prepare Database.bat => Prepare Database.ps1} | 0 .../Scripts/{Refresh Database.bat => Refresh Database.ps1} | 0 .../{Refresh Entire Database.bat => Refresh Entire Database.ps1} | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename TestHarnessExample/Scripts/{Clean Database.bat => Clean Database.ps1} (100%) rename TestHarnessExample/Scripts/{Create Database.bat => Create Database.ps1} (100%) rename TestHarnessExample/Scripts/{Prepare Database.bat => Prepare Database.ps1} (100%) rename TestHarnessExample/Scripts/{Refresh Database.bat => Refresh Database.ps1} (100%) rename TestHarnessExample/Scripts/{Refresh Entire Database.bat => Refresh Entire Database.ps1} (100%) diff --git a/TestHarnessExample/Scripts/Clean Database.bat b/TestHarnessExample/Scripts/Clean Database.ps1 similarity index 100% rename from TestHarnessExample/Scripts/Clean Database.bat rename to TestHarnessExample/Scripts/Clean Database.ps1 diff --git a/TestHarnessExample/Scripts/Create Database.bat b/TestHarnessExample/Scripts/Create Database.ps1 similarity index 100% rename from TestHarnessExample/Scripts/Create Database.bat rename to TestHarnessExample/Scripts/Create Database.ps1 diff --git a/TestHarnessExample/Scripts/Prepare Database.bat b/TestHarnessExample/Scripts/Prepare Database.ps1 similarity index 100% rename from TestHarnessExample/Scripts/Prepare Database.bat rename to TestHarnessExample/Scripts/Prepare Database.ps1 diff --git a/TestHarnessExample/Scripts/Refresh Database.bat b/TestHarnessExample/Scripts/Refresh Database.ps1 similarity index 100% rename from TestHarnessExample/Scripts/Refresh Database.bat rename to TestHarnessExample/Scripts/Refresh Database.ps1 diff --git a/TestHarnessExample/Scripts/Refresh Entire Database.bat b/TestHarnessExample/Scripts/Refresh Entire Database.ps1 similarity index 100% rename from TestHarnessExample/Scripts/Refresh Entire Database.bat rename to TestHarnessExample/Scripts/Refresh Entire Database.ps1 From 4c18b5130c3f16668db35d5e3f82e933d017622f Mon Sep 17 00:00:00 2001 From: Jorre Meijrink Date: Tue, 30 Apr 2019 12:36:08 +0200 Subject: [PATCH 10/13] [DEVLEAD-2984] Use central test credentials also from scripts. --- TestHarnessExample/Scripts/Clean Database.ps1 | 5 ++++- TestHarnessExample/Scripts/Create Database.ps1 | 8 ++++++-- TestHarnessExample/Scripts/CredentialReader.psm1 | 11 +++++++++++ TestHarnessExample/Scripts/DataFresh Usage.bat | 2 -- TestHarnessExample/Scripts/Prepare Database.ps1 | 5 ++++- TestHarnessExample/Scripts/Refresh Database.ps1 | 5 ++++- .../Scripts/Refresh Entire Database.ps1 | 5 ++++- 7 files changed, 33 insertions(+), 8 deletions(-) create mode 100644 TestHarnessExample/Scripts/CredentialReader.psm1 delete mode 100644 TestHarnessExample/Scripts/DataFresh Usage.bat diff --git a/TestHarnessExample/Scripts/Clean Database.ps1 b/TestHarnessExample/Scripts/Clean Database.ps1 index 42bebd1..85ac61b 100644 --- a/TestHarnessExample/Scripts/Clean Database.ps1 +++ b/TestHarnessExample/Scripts/Clean Database.ps1 @@ -1,3 +1,6 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c REMOVE +Import-Module $PSScriptRoot\CredentialReader.psm1 + +$creds = Get-Credentials +.\DataFreshUtil.exe -s $creds.Server -u $creds.UserId -p $creds.Password -d DataFreshSample -c REMOVE pause \ No newline at end of file diff --git a/TestHarnessExample/Scripts/Create Database.ps1 b/TestHarnessExample/Scripts/Create Database.ps1 index 152f83c..f3f7f66 100644 --- a/TestHarnessExample/Scripts/Create Database.ps1 +++ b/TestHarnessExample/Scripts/Create Database.ps1 @@ -1,5 +1,9 @@ -osql.exe -S 127.0.0.1 -U test -P test -d DataFreshSample -i database.sql +Import-Module $PSScriptRoot\CredentialReader.psm1 -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c PREPARE +$creds = Get-Credentials + +osql.exe -S $creds.Server -U $creds.UserId -P $creds.Password -d DataFreshSample -i $PSScriptRoot\database.sql + +.\DataFreshUtil.exe -s $creds.Server -u $creds.UserId -p $creds.Password -d DataFreshSample -c PREPARE pause \ No newline at end of file diff --git a/TestHarnessExample/Scripts/CredentialReader.psm1 b/TestHarnessExample/Scripts/CredentialReader.psm1 new file mode 100644 index 0000000..361a3b7 --- /dev/null +++ b/TestHarnessExample/Scripts/CredentialReader.psm1 @@ -0,0 +1,11 @@ +function Get-Credentials() { + + $rootXml = (Select-Xml -Path "$PSScriptRoot\..\..\TestConnectionStrings.xml" -XPath "/connectionStrings").Node + + $credentialObject = New-Object -TypeName PSObject + $credentialObject | Add-Member -MemberType NoteProperty -Name UserId -TypeName String -Value (Select-Xml -Node $rootXml -XPath "properties/userId").Node.InnerText + $credentialObject | Add-Member -MemberType NoteProperty -Name Password -TypeName String -Value (Select-Xml -Node $rootXml -XPath "properties/password").Node.InnerText + $credentialObject | Add-Member -MemberType NoteProperty -Name Server -TypeName String -Value (Select-Xml -Node $rootXml -XPath "properties/server").Node.InnerText + + $credentialObject +} \ No newline at end of file diff --git a/TestHarnessExample/Scripts/DataFresh Usage.bat b/TestHarnessExample/Scripts/DataFresh Usage.bat deleted file mode 100644 index 94f05ca..0000000 --- a/TestHarnessExample/Scripts/DataFresh Usage.bat +++ /dev/null @@ -1,2 +0,0 @@ -DataFreshUtil.exe -pause \ No newline at end of file diff --git a/TestHarnessExample/Scripts/Prepare Database.ps1 b/TestHarnessExample/Scripts/Prepare Database.ps1 index 7e4acf0..59f1a53 100644 --- a/TestHarnessExample/Scripts/Prepare Database.ps1 +++ b/TestHarnessExample/Scripts/Prepare Database.ps1 @@ -1,3 +1,6 @@ -DataFreshUtil.exe -s 172.17.159.185 -u tf_user -p 1234 -d DataFreshSample -c PREPARE +Import-Module $PSScriptRoot\CredentialReader.psm1 + +$creds = Get-Credentials +.\DataFreshUtil.exe -s $creds.Server -u $creds.UserId -p $creds.Password -d DataFreshSample -c PREPARE pause \ No newline at end of file diff --git a/TestHarnessExample/Scripts/Refresh Database.ps1 b/TestHarnessExample/Scripts/Refresh Database.ps1 index 122dddb..db80fb6 100644 --- a/TestHarnessExample/Scripts/Refresh Database.ps1 +++ b/TestHarnessExample/Scripts/Refresh Database.ps1 @@ -1,3 +1,6 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c REFRESH +Import-Module $PSScriptRoot\CredentialReader.psm1 + +$creds = Get-Credentials +.\DataFreshUtil.exe -s $creds.Server -u $creds.UserId -p $creds.Password -d DataFreshSample -c REFRESH pause \ No newline at end of file diff --git a/TestHarnessExample/Scripts/Refresh Entire Database.ps1 b/TestHarnessExample/Scripts/Refresh Entire Database.ps1 index 3a73942..bbafa14 100644 --- a/TestHarnessExample/Scripts/Refresh Entire Database.ps1 +++ b/TestHarnessExample/Scripts/Refresh Entire Database.ps1 @@ -1,3 +1,6 @@ -DataFreshUtil.exe -s 127.0.0.1 -u test -p test -d DataFreshSample -c FORCEREFRESH +Import-Module $PSScriptRoot\CredentialReader.psm1 + +$creds = Get-Credentials +.\DataFreshUtil.exe -s $creds.Server -u $creds.UserId -p $creds.Password -d DataFreshSample -c FORCEREFRESH pause \ No newline at end of file From d7efe0d096348cb8d4d75e544cb3bc6b492e964d Mon Sep 17 00:00:00 2001 From: Jorre Meijrink Date: Tue, 30 Apr 2019 14:59:46 +0200 Subject: [PATCH 11/13] [DEVLEAD-2984] Fix review feedback. --- TestConnectionStrings.xml | 2 +- Testing.DataFresh/DataFreshConsoleTester.cs | 47 ++++++++++----------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/TestConnectionStrings.xml b/TestConnectionStrings.xml index 2c8c781..e553df7 100644 --- a/TestConnectionStrings.xml +++ b/TestConnectionStrings.xml @@ -2,7 +2,7 @@ tf_user 1234 - 172.17.159.185 + localhost false user id={0};password={1};Initial Catalog=master;Server={2};pooling={3}; diff --git a/Testing.DataFresh/DataFreshConsoleTester.cs b/Testing.DataFresh/DataFreshConsoleTester.cs index 4045ef8..5f82f18 100644 --- a/Testing.DataFresh/DataFreshConsoleTester.cs +++ b/Testing.DataFresh/DataFreshConsoleTester.cs @@ -6,24 +6,21 @@ namespace Testing.DataFresh { [TestFixture] public class DataFreshConsoleTester - { - readonly string userId; - readonly string password; - readonly string server; - - public DataFreshConsoleTester() - { - var doc = new System.Xml.XmlDocument(); - doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), @"..\..\..\TestConnectionStrings.xml")); - //connectionString = connectionString = - // string.Format(doc.SelectSingleNode("/connectionStrings/sqlDataFreshSampleConnectionStringTemplate").InnerText, - userId = doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText; - password = doc.SelectSingleNode("/connectionStrings/properties/password").InnerText; - server = doc.SelectSingleNode("/connectionStrings/properties/server").InnerText; - //doc.SelectSingleNode("/connectionStrings/properties/pooling").InnerText); - } + { + readonly string userId; + readonly string password; + readonly string server; - [SetUp] + public DataFreshConsoleTester() + { + var doc = new System.Xml.XmlDocument(); + doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), @"..\..\..\TestConnectionStrings.xml")); + userId = doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText; + password = doc.SelectSingleNode("/connectionStrings/properties/password").InnerText; + server = doc.SelectSingleNode("/connectionStrings/properties/server").InnerText; + } + + [SetUp] public void Setup() { ExecuteDataFreshConsole("PREPARE"); @@ -38,7 +35,7 @@ public void TearDown() [Test] public void NoArgs() { - string[] args = new string[] {}; + string[] args = new string[] { }; DataFreshConsole console = new DataFreshConsole(); console.Start(args); } @@ -46,7 +43,7 @@ public void NoArgs() [Test] public void BlankArgs() { - string[] args = new string[] {"", ""}; + string[] args = new string[] { "", "" }; DataFreshConsole console = new DataFreshConsole(); console.Start(args); } @@ -81,7 +78,7 @@ public void RefreshCommand() public void RefreshWithoutPrepareCommand() { ExecuteDataFreshConsole("REMOVE"); - Assert.Throws(() => ExecuteDataFreshConsole("REFRESH")); + Assert.Throws(() => ExecuteDataFreshConsole("REFRESH")); } [Test] @@ -111,13 +108,13 @@ public void PassServerNameCheckConnectionString() Assert.AreEqual(serverInstance, console.arguments["s"]); string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost;"; Assert.AreEqual(expectedConnectionString, console.connectionString); - } - + } + [Test] public void CheckSnapshotPath() - { - //-sp "${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData"" - //-sp '${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData' + { + //-sp "${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData"" + //-sp '${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData' string snapshotPath = @"c:\temp"; DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", "localhost", "DataFreshSample", "-sp", snapshotPath); Assert.AreEqual(6, console.arguments.Keys.Count); From 2d3271b13815b7e992ecfbbda05979dbb74f56c4 Mon Sep 17 00:00:00 2001 From: Dmytro Pryvedeniuk Date: Mon, 12 Oct 2020 13:46:00 +0300 Subject: [PATCH 12/13] [DEVLEAD-3700] Use SqlBulkCopy to create snapshots and restore --- DataFresh.Common/AssemblyInfo.cs | 93 ++- DataFresh.Common/DataFresh.Common.csproj | 2 +- DataFresh/AssemblyInfo.cs | 5 +- DataFresh/DataFresh.csproj | 6 +- DataFresh/DataFreshConsole.cs | 146 ++--- DataFresh/IDataFresh.cs | 18 +- DataFresh/ResourceManagement.cs | 148 ----- DataFresh/Resources/PrepareDataFresh.sql | 290 ---------- DataFresh/Resources/RemoveDataFresh.sql | 27 - DataFresh/SqlDataFresh.cs | 538 ++++++++++++------ DataFreshUtil/AssemblyInfo.cs | 3 +- DataFreshUtil/DataFreshUtil.csproj | 2 +- DataFreshUtil/EntryPoint.cs | 40 +- ...opyZero DataFresh Solution.sln.DotSettings | 17 + TestHarnessExample/TestFixtureBase.cs | 8 +- Testing.DataFresh/DataFreshConsoleTester.cs | 72 +-- Testing.DataFresh/SqlDataFreshTester.cs | 149 ++--- Testing.DataFresh/TestFixtureBase.cs | 68 ++- 18 files changed, 614 insertions(+), 1018 deletions(-) delete mode 100644 DataFresh/ResourceManagement.cs delete mode 100644 DataFresh/Resources/PrepareDataFresh.sql delete mode 100644 DataFresh/Resources/RemoveDataFresh.sql create mode 100644 EntropyZero DataFresh Solution.sln.DotSettings diff --git a/DataFresh.Common/AssemblyInfo.cs b/DataFresh.Common/AssemblyInfo.cs index 9f89a32..79861e1 100644 --- a/DataFresh.Common/AssemblyInfo.cs +++ b/DataFresh.Common/AssemblyInfo.cs @@ -1,11 +1,10 @@ using System.Reflection; -using System.Runtime.CompilerServices; - -// -// 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. -// + +// +// 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("")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] @@ -13,46 +12,46 @@ [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// 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 Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// +[assembly: AssemblyCulture("")] + +// +// 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 Revision and Build Numbers +// by using the '*' as shown below: + +[assembly: AssemblyVersion("1.0.*")] + +// +// In order to sign your assembly you must specify a key to use. Refer to the +// Microsoft .NET Framework documentation for more information on assembly signing. +// +// Use the attributes below to control which key is used for signing. +// +// Notes: +// (*) If no key is specified, the assembly is not signed. +// (*) KeyName refers to a key that has been installed in the Crypto Service +// Provider (CSP) on your machine. KeyFile refers to a file which contains +// a key. +// (*) If the KeyFile and the KeyName values are both specified, the +// following processing occurs: +// (1) If the KeyName can be found in the CSP, that key is used. +// (2) If the KeyName does not exist and the KeyFile does exist, the key +// in the KeyFile is installed into the CSP and used. +// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. +// When specifying the KeyFile, the location of the KeyFile should be +// relative to the project output directory which is +// %Project Directory%\obj\. For example, if your KeyFile is +// located in the project directory, you would specify the AssemblyKeyFile +// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] +// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework +// documentation for more information on this. +// [assembly: AssemblyDelaySign(false)] [assembly: AssemblyKeyFile("")] [assembly: AssemblyKeyName("")] diff --git a/DataFresh.Common/DataFresh.Common.csproj b/DataFresh.Common/DataFresh.Common.csproj index 0f28634..1f18ba2 100644 --- a/DataFresh.Common/DataFresh.Common.csproj +++ b/DataFresh.Common/DataFresh.Common.csproj @@ -28,7 +28,7 @@ - bin\Debug\ + ..\..\..\Source\Legacy\wwwroot\bin\ false 285212672 false diff --git a/DataFresh/AssemblyInfo.cs b/DataFresh/AssemblyInfo.cs index 6be57f4..5b92d94 100644 --- a/DataFresh/AssemblyInfo.cs +++ b/DataFresh/AssemblyInfo.cs @@ -1,4 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyTitleAttribute("dataFresh")] -[assembly: DataFresh.AssemblyResourceEncrpytion(false)] +[assembly: AssemblyVersion("2.0.0.0")] +[assembly: AssemblyTitle("dataFresh")] \ No newline at end of file diff --git a/DataFresh/DataFresh.csproj b/DataFresh/DataFresh.csproj index b68ff65..24c291f 100644 --- a/DataFresh/DataFresh.csproj +++ b/DataFresh/DataFresh.csproj @@ -90,9 +90,6 @@ Code - - Code - Code @@ -100,9 +97,8 @@ Code - - + diff --git a/DataFresh/DataFreshConsole.cs b/DataFresh/DataFreshConsole.cs index 6bc4fbd..b349213 100644 --- a/DataFresh/DataFreshConsole.cs +++ b/DataFresh/DataFreshConsole.cs @@ -1,40 +1,43 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + using System; using System.Collections.Specialized; -using System.IO; using System.Text; namespace DataFresh { public class DataFreshConsole { - private StringBuilder results = new StringBuilder(); - - public NameValueCollection arguments = new NameValueCollection(); - public string connectionString = string.Empty; + readonly StringBuilder results = new StringBuilder(); - public string Results + public DataFreshConsole() { - get { return results.ToString(); } + ConnectionString = string.Empty; + Arguments = new NameValueCollection(); } + public string Results => results.ToString(); + + public NameValueCollection Arguments { get; } + + public string ConnectionString { get; set; } + public void Start(string[] args) { ConsoleWrite("DataFresh provided by Entropy Zero Consulting"); @@ -45,55 +48,26 @@ public void Start(string[] args) return; } - for (int i = 0; i < args.Length; i = i + 2) - { - this.arguments.Add(args[i].Replace("-", ""), args[i + 1]); - //ConsoleWrite(args[i] + ": " +args[i+1]); - } + for (var i = 0; i < args.Length; i += 2) + Arguments.Add(args[i].Replace("-", ""), args[i + 1]); - if (!CheckForRequiredArguments(this.arguments)) + if (!CheckForRequiredArguments(Arguments)) { return; } - connectionString = string.Format(@"user id={0};password={1};Initial Catalog={2};Data Source={3};", - this.arguments["u"], - this.arguments["p"], - this.arguments["d"], - this.arguments["s"]); - - SqlDataFresh dataFresh = new SqlDataFresh(connectionString, true); + ConnectionString = + $@"user id={Arguments["u"]};password={Arguments["p"]};Initial Catalog={Arguments["d"]};Data Source={Arguments["s"]};"; - string snapshotPath = this.arguments["sp"]; + var dataFresh = new SqlDataFresh(ConnectionString, true); - if (snapshotPath != null) - { - snapshotPath = snapshotPath.Replace("\"", ""); - if (!snapshotPath.EndsWith(@"\")) - { - snapshotPath += @"\"; - } - - ConsoleWrite("snapshotPath = {0}", snapshotPath); - string fullPath = Path.GetFullPath(snapshotPath); - ConsoleWrite("fullPath = {0}", fullPath); - dataFresh.SnapshotPath = new DirectoryInfo(snapshotPath); - } - - string command = this.arguments["c"].ToUpper(); + var command = Arguments["c"].ToUpper(); switch (command) { case "PREPARE": - bool ignoreSnapshot = false; - string ignoreSnapshotArgument = arguments["ignoresnapshot"]; - if(ignoreSnapshotArgument != null) - { - if(ignoreSnapshotArgument == "1") - { - ignoreSnapshot = true; - } - } - dataFresh.PrepareDatabaseforDataFresh(!ignoreSnapshot); + var ignoreSnapshotArgument = Arguments["ignoresnapshot"]; + var ignoreSnapshot = (ignoreSnapshotArgument != null && ignoreSnapshotArgument == "1"); + dataFresh.PrepareDatabaseForDataFresh(!ignoreSnapshot); break; case "REFRESH": dataFresh.RefreshTheDatabase(); @@ -107,8 +81,8 @@ public void Start(string[] args) case "SNAPSHOT": dataFresh.CreateSnapshot(); break; - case "FOO": - //no nothing + case "FOO": + //no nothing break; default: ConsoleWrite("Command '{0}' was not recognized", command); @@ -116,7 +90,7 @@ public void Start(string[] args) } } - private void ConsoleWrite(string message, params object[] args) + void ConsoleWrite(string message, params object[] args) { results.AppendFormat(message, args); results.AppendFormat(Environment.NewLine); @@ -124,27 +98,22 @@ private void ConsoleWrite(string message, params object[] args) Console.Out.WriteLine(message, args); } - private bool CheckForRequiredArguments(NameValueCollection myArgs) + bool CheckForRequiredArguments(NameValueCollection myArgs) { - if ( - myArgs == null || - myArgs["c"] == null || - myArgs["s"] == null || - myArgs["d"] == null || - myArgs["u"] == null || - myArgs["p"] == null - ) - { - ConsoleWrite("Missing required arguments."); - WriteUsage(); - return false; - } - return true; + if (myArgs?["c"] != null + && myArgs["s"] != null + && myArgs["d"] != null + && myArgs["u"] != null + && myArgs["p"] != null) return true; + + ConsoleWrite("Missing required arguments."); + WriteUsage(); + return false; } - private void WriteUsage() + void WriteUsage() { - string usageText = @" + const string usageText = @" Usage: DataFreshUtil.exe @@ -156,7 +125,6 @@ private void WriteUsage() Options: - -sp specify path on server where snapshot files are located -ignoresnapshot 1: ignore snapshot during prepare 0: (default) will create snapshot @@ -174,7 +142,7 @@ SNAPSHOT create a snapshot of your database public static DataFreshConsole Execute(string command, string username, string password, string server, string database, params string[] options) { - string[] args = new string[] + var args = new[] { "-c", command, "-u", username, @@ -185,12 +153,12 @@ public static DataFreshConsole Execute(string command, string username, string p if (options != null && options.Length > 1) { - string argsString = string.Join("|", args); - string optionsString = string.Join("|", options); + var argsString = string.Join("|", args); + var optionsString = string.Join("|", options); args = string.Format(argsString + "|" + optionsString).Split('|'); } - DataFreshConsole console = new DataFreshConsole(); + var console = new DataFreshConsole(); console.Start(args); return console; } diff --git a/DataFresh/IDataFresh.cs b/DataFresh/IDataFresh.cs index a030e17..f2c05bd 100644 --- a/DataFresh/IDataFresh.cs +++ b/DataFresh/IDataFresh.cs @@ -16,8 +16,6 @@ // Free Software Foundation, Inc., // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -using System.IO; - namespace DataFresh { public interface IDataFresh @@ -25,7 +23,7 @@ public interface IDataFresh /// /// prepare the database to use the dataFresh library /// - void PrepareDatabaseforDataFresh(); + void PrepareDatabaseForDataFresh(); /// /// refresh the database to a known state @@ -47,19 +45,5 @@ public interface IDataFresh /// refresh the database ignoring the dataFresh change tracking table. /// void RefreshTheEntireDatabase(); - - /// - /// create snapshot of database - /// - void CreateSnapshot(); - - /// - /// location on the server where the snapshot files are located - /// - DirectoryInfo SnapshotPath - { - get; - set; - } } } \ No newline at end of file diff --git a/DataFresh/ResourceManagement.cs b/DataFresh/ResourceManagement.cs deleted file mode 100644 index d800bac..0000000 --- a/DataFresh/ResourceManagement.cs +++ /dev/null @@ -1,148 +0,0 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.IO; -using System.Reflection; -using System.Security.Cryptography; - -namespace DataFresh -{ - [AttributeUsage(AttributeTargets.Assembly)] - public class AssemblyResourceEncrpytion : Attribute - { - private bool enryptionEnabled; - private string enryptionKey = "nopassword"; - - public AssemblyResourceEncrpytion() - { - enryptionEnabled = true; - } - - public AssemblyResourceEncrpytion(bool enabled) - { - enryptionEnabled = enabled; - } - - public virtual bool Enabled - { - get - { - return enryptionEnabled; - } - set - { - enryptionEnabled = value; - } - } - - public virtual string Key - { - get - { - return enryptionKey; - } - } - } - - public class ResourceManagement - { - public static bool EncryptionEnabled - { - get - { - object[] customAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyResourceEncrpytion), false); - if(customAttributes != null && customAttributes.Length > 0) - { - AssemblyResourceEncrpytion enc = (AssemblyResourceEncrpytion) customAttributes[0]; - return enc.Enabled; - } - return false; - } - } - - public static string EncryptionKey - { - get - { - object[] customAttributes = Assembly.GetCallingAssembly().GetCustomAttributes(typeof(AssemblyResourceEncrpytion), false); - if(customAttributes != null && customAttributes.Length > 0) - { - AssemblyResourceEncrpytion enc = (AssemblyResourceEncrpytion) customAttributes[0]; - return enc.Key; - } - throw new Exception("Encryption key was not set!"); - } - } - - public static string GetDecryptedResource(string name) - { - byte[] dec = GetDecryptedResourceBytes(name); - string decStr = new MemoryStream(dec).ToString(); - return decStr; - } - - public static StreamReader GetDecryptedResourceStream(string name) - { - StreamReader reader = new StreamReader(new MemoryStream(GetDecryptedResourceBytes(name))); - return reader; - } - - public static byte[] GetDecryptedResourceBytes(string name) - { - Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name); - int length = (int)stream.Length; - byte[] bytes = new byte[length]; - stream.Read(bytes, 0, length); - if(EncryptionEnabled) - { - return Decrypt(bytes, EncryptionKey); - } - else - { - return bytes; - } - } - - public static byte[] Decrypt(byte[] cipherData, byte[] Key, byte[] IV) - { - MemoryStream ms = new MemoryStream(); - Rijndael alg = Rijndael.Create(); - alg.Key = Key; - alg.IV = IV; - CryptoStream cs = new CryptoStream(ms, alg.CreateDecryptor(), CryptoStreamMode.Write); - cs.Write(cipherData, 0, cipherData.Length); - cs.Flush(); - cs.Close(); - byte[] decryptedData = ms.ToArray(); - return decryptedData; - } - - public static byte[] Decrypt(byte[] cipherData, string Password) - { - PasswordDeriveBytes pdb = new PasswordDeriveBytes(Password, - new byte[] - { - 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, - 0x65, 0x76 - }); - - return Decrypt(cipherData, pdb.GetBytes(32), pdb.GetBytes(16)); - } - } -} diff --git a/DataFresh/Resources/PrepareDataFresh.sql b/DataFresh/Resources/PrepareDataFresh.sql deleted file mode 100644 index bad41dd..0000000 --- a/DataFresh/Resources/PrepareDataFresh.sql +++ /dev/null @@ -1,290 +0,0 @@ -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangedTableDataRefresh]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangedTableDataRefresh] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerCreate]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerCreate] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerRemove] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataExtract]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataExtract] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataImport]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataImport] -GO - -IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) - DROP TABLE [dbo].[df_ChangeTracking] -GO - -CREATE TABLE [dbo].[df_ChangeTracking] - ( - [TABLESCHEMA] sysname, - [TABLENAME] sysname - ) -GO - -CREATE PROCEDURE dbo.[df_ChangedTableDataRefresh] -( - @BasePath NVARCHAR(512) -) -AS - - DECLARE @sql NVARCHAR(4000) - DECLARE @TableSchema VARCHAR(255) - DECLARE @TableName VARCHAR(255) - - SELECT DISTINCT TableSchema, TableName INTO #ChangedTables FROM df_ChangeTracking - - TRUNCATE TABLE df_ChangeTracking - - DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tableschema], [tablename] from #ChangedTables - UNION - SELECT DISTINCT - OBJECT_SCHEMA_NAME(fkeyid) AS Referenced_Table_Schema, - OBJECT_NAME(fkeyid) AS Referenced_Table_Name - FROM - sysreferences sr - INNER JOIN #ChangedTables ct ON sr.rkeyid = OBJECT_ID(ct.tablename) - - OPEN Table_Cursor - - -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] NOCHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - END - - -- Delete All data from Changed Tables and Refill - DECLARE ChangedTable_Cursor CURSOR FOR - SELECT [tableschema], [tablename] FROM #ChangedTables WHERE tablename not in('df_ChangeTracking', 'dr_DeltaVersion') - - OPEN ChangedTable_Cursor - FETCH NEXT FROM ChangedTable_Cursor INTO @TableSchema, @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - PRINT @TableName - SET @sql = N'DELETE [' + @TableSchema + '].[' + @TableName + ']; DELETE FROM df_ChangeTracking WHERE TableName=''' + @TableName + ''' and TableSchema=''' + @TableSchema + '''' - EXEC sp_executesql @sql - - SET @sql = N'IF(SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE table_schema = ''' + @TableSchema + ''' AND table_name = ''' + @TableName + ''' AND IDENT_SEED(TABLE_NAME) IS NOT NULL) > 0 - BEGIN - DBCC CHECKIDENT ([' + @TableSchema + '.' + @TableName + '], RESEED, 0) - END' - - EXEC sp_executesql @sql - - - SET @sql = N'BULK INSERT [' + @TableSchema + '].[' + @TableName + '] - FROM ''' + @BasePath + @TableSchema + '.' + @TableName + '.df'' - WITH - ( - KEEPIDENTITY, - KEEPNULLS, - DATAFILETYPE=''native'' - )' - EXEC sp_executesql @sql - - FETCH NEXT FROM ChangedTable_Cursor INTO @TableSchema, @TableName - END - CLOSE ChangedTable_Cursor - DEALLOCATE ChangedTable_Cursor - - -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableSchema, @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] CHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - END - CLOSE Table_Cursor - DEALLOCATE Table_Cursor -GO - - -CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerCreate] -AS - - IF NOT EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) - CREATE TABLE [df_ChangeTracking] - ( - [TABLESCHEMA] sysname, - [TABLENAME] sysname - ) - - DECLARE @sql NVARCHAR(4000) - DECLARE @TableSchema VARCHAR(255) - DECLARE @TableName VARCHAR(255) - - DECLARE Table_Cursor CURSOR FOR - SELECT [table_schema], [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' - - OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'IF EXISTS (SELECT * FROM dbo.SYSOBJECTS WHERE ID = Object_ID(N''[' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) - DROP TRIGGER [' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']' - EXEC sp_executesql @sql - - SET @sql = N'CREATE TRIGGER [' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + '] on [' + @TableSchema + '].[' + @TableName + '] for insert, update, delete - as - SET NOCOUNT ON - INSERT INTO df_ChangeTracking (tableschema, tablename) VALUES (''' + @TableSchema + ''', ''' + @TableName + ''') - SET NOCOUNT OFF' - - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - - END - CLOSE Table_Cursor - DEALLOCATE Table_Cursor - -GO - -CREATE PROCEDURE dbo.[df_TableDataExtract] -( - @BasePath NVARCHAR(512) -) -AS - - DECLARE @MkDirCmd NVARCHAR(4000) - - SET @MkDirCmd = N'MKDIR "' + @BASEPATH + '"' - EXEC master.dbo.xp_cmdshell @MkDirCmd, no_output - - DECLARE @CMD NVARCHAR(4000) - - DECLARE Table_Cursor CURSOR FOR - SELECT N'bcp "' + DB_NAME() + '.[' + Table_Schema + '].[' + Table_Name + ']" out "' + @BasePath + Table_Schema + '.' + Table_Name + '.df" -n -k -E -C 1252 -S ' + @@ServerName + ' -T' FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' - - OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @CMD - - WHILE (@@Fetch_Status = 0) - BEGIN - EXEC master.dbo.xp_cmdshell @CMD, no_output - FETCH NEXT FROM Table_Cursor INTO @CMD - END - - CLOSE Table_Cursor - Deallocate Table_Cursor - -GO - -CREATE PROCEDURE dbo.[df_TableDataImport] -( - @BasePath NVARCHAR(512) -) -AS - - DECLARE @sql NVARCHAR(4000) - DECLARE @TableSchema VARCHAR(255) - DECLARE @TableName VARCHAR(255) - - SELECT Table_Schema as TableSchema, Table_Name as TableName INTO #UserTables FROM Information_Schema.tables WHERE table_type = 'BASE TABLE' - - DECLARE Table_Cursor INSENSITIVE SCROLL CURSOR FOR - SELECT [tableschema], [tablename] FROM #UserTables - - OPEN Table_Cursor - - -- Deactivate Constrains for tables referencing changed tables - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] NOCHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - END - - -- Delete All data from Changed Tables and Refill - DECLARE UserTable_Cursor CURSOR FOR - SELECT [tableschema], [tablename] FROM #UserTables WHERE tablename not in ('df_ChangeTracking', 'dr_DeltaVersion') - - OPEN UserTable_Cursor - - FETCH NEXT FROM UserTable_Cursor INTO @TableSchema, @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - PRINT @TableSchema + '.' + @TableName - SET @sql = N'DELETE [' + @TableSchema + '].[' + @TableName + ']' - EXEC sp_executesql @sql - - SET @sql = N'BULK INSERT [' + @TableSchema + '].[' + @TableName + '] - FROM ''' + @BasePath + @TableName + '.df'' - WITH - ( - KEEPIDENTITY, - KEEPNULLS, - DATAFILETYPE=''native'' - )' - EXEC sp_executesql @sql - - FETCH NEXT FROM UserTable_Cursor INTO @TableSchema, @TableName - - END - CLOSE UserTable_Cursor - DEALLOCATE UserTable_Cursor - - -- ReEnable Constrants for All Tables - FETCH FIRST FROM Table_Cursor INTO @TableSchema, @TableName - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'Alter Table [' + @TableSchema + '].[' + @TableName + '] CHECK CONSTRAINT ALL' - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - END - - CLOSE Table_Cursor - DEALLOCATE Table_Cursor - -GO - -CREATE PROCEDURE dbo.[df_ChangeTrackingTriggerRemove] -AS - DECLARE @sql NVARCHAR(4000) - DECLARE @TableSchema VARCHAR(255) - DECLARE @TableName VARCHAR(255) - - DECLARE Table_Cursor CURSOR FOR - SELECT [table_schema], [table_name] FROM information_schema.tables WHERE table_type = 'BASE TABLE' - - OPEN Table_Cursor - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - - WHILE (@@Fetch_Status = 0) - BEGIN - SET @sql = N'IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = Object_ID(N''[' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']'') AND OBJECTPROPERTY(ID, N''IsTrigger'') = 1) - DROP TRIGGER [' + @TableSchema + '].[trig_df_ChangeTracking_' + @TableName + ']' - - EXEC sp_executesql @sql - - FETCH NEXT FROM Table_Cursor INTO @TableSchema, @TableName - - END - CLOSE Table_Cursor - DEALLOCATE Table_Cursor - - IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[df_ChangeTracking]') and OBJECTPROPERTY(id, N'IsUserTable') = 1) - DROP TABLE [dbo].[df_ChangeTracking] - -GO \ No newline at end of file diff --git a/DataFresh/Resources/RemoveDataFresh.sql b/DataFresh/Resources/RemoveDataFresh.sql deleted file mode 100644 index bf75522..0000000 --- a/DataFresh/Resources/RemoveDataFresh.sql +++ /dev/null @@ -1,27 +0,0 @@ -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - EXEC df_ChangeTrackingTriggerRemove -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangedTableDataRefresh]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangedTableDataRefresh] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerCreate]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerCreate] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTrackingTriggerRemove]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_ChangeTrackingTriggerRemove] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataExtract]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataExtract] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_TableDataImport]') AND OBJECTPROPERTY(ID, N'IsProcedure') = 1) - DROP PROCEDURE [dbo].[df_TableDataImport] -GO - -IF EXISTS (SELECT * FROM [DBO].SYSOBJECTS WHERE ID = Object_ID(N'[DBO].[df_ChangeTracking]') AND OBJECTPROPERTY(ID, N'IsTable') = 1) - DROP TABLE [dbo].[df_ChangeTracking] -GO \ No newline at end of file diff --git a/DataFresh/SqlDataFresh.cs b/DataFresh/SqlDataFresh.cs index 930aeee..68114c7 100644 --- a/DataFresh/SqlDataFresh.cs +++ b/DataFresh/SqlDataFresh.cs @@ -1,28 +1,30 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + using System; +using System.Collections.Generic; using System.Data.SqlClient; -using System.IO; +using System.Diagnostics; +using System.Linq; using System.Text; namespace DataFresh -{ +{ /// /// dataFresh by Entropy Zero Consulting is a library that will enable /// the test driven developer to build a test harness that will refresh @@ -30,248 +32,412 @@ namespace DataFresh /// public class SqlDataFresh : IDataFresh { - #region Member Variables - - private string connectionString = null; - private DirectoryInfo snapshotPath = null; - - private string PrepareScriptResourceName = "DataFresh.Resources.PrepareDataFresh.sql"; - private string RemoveScriptResourceName = "DataFresh.Resources.RemoveDataFresh.sql"; - - public string PrepareProcedureName = "df_ChangeTrackingTriggerCreate"; - public string RefreshProcedureName = "df_ChangedTableDataRefresh"; - public string ExtractProcedureName = "df_TableDataExtract"; - public string ImportProcedureName = "df_TableDataImport"; - public string ChangeTrackingTableName = "df_ChangeTracking"; - - private bool verbose = false; - - #endregion + readonly string connectionString; + public const string ChangeTrackingTableName = "df_ChangeTracking"; + const string SnapshotTableSuffix = "__backup"; + + sealed class TableMetadata + { + public string Schema { get; set; } + public string Name { get; set; } + } - #region Public Methods + readonly bool verbose; + readonly string databaseName; public SqlDataFresh(string connectionString) { this.connectionString = connectionString; + var connectionBuilder = new SqlConnectionStringBuilder(connectionString); + databaseName = connectionBuilder.InitialCatalog; } public SqlDataFresh(string connectionString, bool verbose) + : this(connectionString) { - this.connectionString = connectionString; this.verbose = verbose; } - public bool TableExists(string tableName) + public void PrepareDatabaseForDataFresh() { - int tableCount = Int32.Parse(ExecuteScalar(string.Format("SELECT COUNT(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='{0}'", tableName)).ToString()); - return (tableCount > 0); + PrepareDatabaseForDataFresh(true); } - public bool ProcedureExists(string procedureName) - { - int procedureCount = Int32.Parse(ExecuteScalar(string.Format("SELECT COUNT(ROUTINE_NAME) FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_NAME='{0}'", procedureName)).ToString()); - return (procedureCount > 0); + public void PrepareDatabaseForDataFresh(bool createSnapshot) + { + var mode = createSnapshot ? "(with snapshot creation)" : string.Empty; + Execute($"Prepare database{mode}", () => + { + PrepareDataFresh(); + + if (createSnapshot) + CreateSnapshot(); + }); } - #endregion + public void CreateSnapshot() + { + GuardDatabaseIsPrepared(); + Execute("Create snapshot", () => + { + var allTables = GetAllTables(); + PerformBulkBackup(allTables); + }); + } - #region IDataFresh Members + void PrepareDataFresh() + { + Execute("Prepare DataFresh", () => + { + var allTables = GetAllTables(); + + ExecuteNonQuery(@" + IF OBJECT_ID(N'[dbo].[df_ChangeTracking]', N'U') IS NOT NULL + BEGIN + DROP TABLE [dbo].[df_ChangeTracking] + END; + + CREATE TABLE [dbo].[df_ChangeTracking] ([TableSchema] SYSNAME, [TableName] SYSNAME)" + ); + + ExecuteForEach(allTables, t => $@" + IF OBJECT_ID(N'[{t.Schema}].[trig_df_ChangeTracking_{t.Name}]') IS NOT NULL + BEGIN + DROP TRIGGER [{t.Schema}].[trig_df_ChangeTracking_{t.Name}] + END; + + EXEC (N'CREATE TRIGGER [{t.Schema}].[trig_df_ChangeTracking_{t.Name}] ON [{t.Schema}].[{t.Name}] + FOR INSERT, UPDATE, DELETE + AS + SET NOCOUNT ON + INSERT INTO df_ChangeTracking (TableSchema, TableName) VALUES (''{t.Schema}'', ''{t.Name}'') + SET NOCOUNT OFF');" + ); + }); + } - /// - /// prepare the database to use the dataFresh library - /// - public void PrepareDatabaseforDataFresh() + public void RemoveDataFreshFromDatabase() { - PrepareDatabaseforDataFresh(true); + Execute("Remove DataFresh", () => + { + var allTables = GetAllTables(); + + ExecuteForEach(allTables, t => $@" + IF (OBJECT_ID(N'[{t.Schema}].[trig_df_ChangeTracking_{t.Name}]') IS NOT NULL) + BEGIN + DROP TRIGGER [{t.Schema}].[trig_df_ChangeTracking_{t.Name}] + END; + + IF OBJECT_ID (N'[{t.Schema}].[{t.Name}{SnapshotTableSuffix}]', N'U') IS NOT NULL + BEGIN + DROP TABLE [{t.Schema}].[{t.Name}{SnapshotTableSuffix}]; + END;" + ); + + ExecuteNonQuery(@" + IF OBJECT_ID (N'[dbo].[df_ChangeTracking]', N'U') IS NOT NULL + DROP TABLE [dbo].[df_ChangeTracking]" + ); + }); } - public void PrepareDatabaseforDataFresh(bool createSnapshot) + public void RefreshTheDatabase() + { + GuardDatabaseIsPrepared(); + Execute("Refresh", () => + { + var changedAndReferencedTables = GetChangedAndReferencedTables(); + var changedTables = GetChangedTables(); + + ExecuteNonQuery($"TRUNCATE TABLE [dbo].[{ChangeTrackingTableName}]"); + + ExecuteForEach(changedAndReferencedTables, t => + $"ALTER TABLE [{t.Schema}].[{t.Name}] NOCHECK CONSTRAINT ALL;" + ); + + ExecuteForEach(changedTables, t => $@" + DELETE [{t.Schema}].[{t.Name}]; + DELETE FROM df_ChangeTracking WHERE TableName='{t.Name}' and TableSchema='{t.Schema}'; + + IF (SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES + WHERE table_schema = '{t.Schema}' AND table_name = '{t.Name}' + AND IDENT_SEED(TABLE_NAME) IS NOT NULL) > 0 + BEGIN + DBCC CHECKIDENT([{t.Schema}.{t.Name}], RESEED, 0) + END" + ); + + PerformBulkRestore(changedTables); + + ExecuteForEach(changedAndReferencedTables, t => + $"ALTER TABLE [{t.Schema}].[{t.Name}] CHECK CONSTRAINT ALL;" + ); + }); + } + + public void RefreshTheEntireDatabase() { - DateTime before = DateTime.Now; - ConsoleWrite("PrepareDatabaseforDataFresh Started"); - RunSqlScript(ResourceManagement.GetDecryptedResourceStream(PrepareScriptResourceName)); + GuardDatabaseIsPrepared(); + Execute("Refresh (entire)", () => + { + var allTables = GetAllTables(); + var changedTables = GetChangedTables(); + ExecuteNonQuery($"TRUNCATE TABLE [dbo].[{ChangeTrackingTableName}]"); - ExecuteNonQuery("exec " + PrepareProcedureName); + ExecuteForEach(allTables, t => + $"ALTER TABLE [{t.Schema}].[{t.Name}] NOCHECK CONSTRAINT ALL;" + ); - if(createSnapshot) - { - CreateSnapshot(); - } - ConsoleWrite("PrepareDatabaseforDataFresh Complete : " + (DateTime.Now - before)); + ExecuteForEach(changedTables, t => + $"DELETE FROM [{t.Schema}].[{t.Name}]" + ); + + PerformBulkRestore(changedTables); + + ExecuteForEach(allTables, t => + $"ALTER TABLE [{t.Schema}].[{t.Name}] CHECK CONSTRAINT ALL;" + ); + }); } - /// - /// remove the dataFresh objects from a database - /// - public void RemoveDataFreshFromDatabase() + public bool HasDatabaseBeenModified() { - DateTime before = DateTime.Now; - ConsoleWrite("RemoveDataFreshFromDatabase Started"); - RunSqlScript(ResourceManagement.GetDecryptedResourceStream(RemoveScriptResourceName)); - ConsoleWrite("RemoveDataFreshFromDatabase Complete : " + (DateTime.Now - before)); + GuardDatabaseIsPrepared(); + var sql = + $@"SELECT COUNT(*) FROM {ChangeTrackingTableName} + WHERE TableName <> 'ChangeTrackingTableName' + AND TableName NOT LIKE '%{SnapshotTableSuffix}'"; + var ret = Convert.ToInt32(ExecuteScalar(sql)); + return ret > 0; } - /// - /// refresh the database to a known state - /// - public void RefreshTheDatabase() + public void RunStatements(IEnumerable statements) { - DateTime before = DateTime.Now; - ConsoleWrite("RefreshTheDatabase Started"); - if (!ProcedureExists(RefreshProcedureName)) + var cb = new StringBuilder(); + const int maxLength = 6000; + var currentLength = 0; + foreach (var statement in statements) { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); + if (currentLength + statement.Length > maxLength) + Flush(); + + currentLength += statement.Length; + cb.Append(statement); } - ExecuteNonQuery(string.Format("exec {0} '{1}'", RefreshProcedureName, SnapshotPath.FullName)); - ConsoleWrite("RefreshTheDatabase Complete : " + (DateTime.Now - before)); - } - /// - /// refresh the database ignoring the dataFresh change tracking table. - /// - public void RefreshTheEntireDatabase() - { - DateTime before = DateTime.Now; - ConsoleWrite("RefreshTheEntireDatabase Started"); - if (!ProcedureExists(ImportProcedureName)) + if (currentLength > 0) + Flush(); + + void Flush() { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); + ExecuteNonQuery(cb.ToString()); + cb.Clear(); + currentLength = 0; } - ExecuteNonQuery(string.Format("exec {0} '{1}'", ImportProcedureName, SnapshotPath.FullName)); - ConsoleWrite("RefreshTheEntireDatabase Complete : " + (DateTime.Now - before)); } - /// - /// create snapshot of database - /// - public void CreateSnapshot() + void PerformBulkBackup(IReadOnlyCollection tables) { - DateTime before = DateTime.Now; - ConsoleWrite("CreateSnapshot Started"); - if (!ProcedureExists(ExtractProcedureName)) - { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); - } - ExecuteNonQuery(string.Format("exec {0} '{1}'", ExtractProcedureName, SnapshotPath.FullName)); - ConsoleWrite("CreateSnapshot Complete : " + (DateTime.Now - before)); + PerformBulkOperation(tables, backup: true); } - /// - /// determine if the database has been modified - /// - /// true if modified. - public bool HasDatabaseBeenModified() + void PerformBulkRestore(IReadOnlyCollection tables) { - if (!TableExists(ChangeTrackingTableName)) - { - throw new SqlDataFreshException("DataFresh procedure not found. Please prepare the database."); - } + PerformBulkOperation(tables, backup: false); + } - string sql = string.Format(@"SELECT COUNT(*) FROM {0} WHERE TableName <> '{0}'", ChangeTrackingTableName); - int ret = Convert.ToInt32(ExecuteScalar(sql)); - return ret > 0; + void PerformBulkOperation(IReadOnlyCollection tables, bool backup) + { + var destinationSuffix = backup ? SnapshotTableSuffix : string.Empty; + var sourceSuffix = backup ? string.Empty : SnapshotTableSuffix; + + if (backup) + { + ExecuteForEach(tables, t => + { + var sourceTable = $"[{t.Schema}].[{t.Name}{sourceSuffix}]"; + var destinationTable = $"[{t.Schema}].[{t.Name}{destinationSuffix}]"; + + return $@" + IF OBJECT_ID (N'{destinationTable}', N'U') IS NULL BEGIN + SELECT * INTO {destinationTable} FROM {sourceTable} WHERE 1=2 END + ELSE BEGIN + TRUNCATE TABLE {destinationTable} + END;"; + }); + } + + foreach (var table in tables) + { + var sourceTable = $"[{table.Schema}].[{table.Name}{sourceSuffix}]"; + var destinationTable = $"[{table.Schema}].[{table.Name}{destinationSuffix}]"; + + CopyTable(connectionString, sourceTable, destinationTable); + } } - /// - /// location on the server where the snapshot files are located - /// - public DirectoryInfo SnapshotPath + static void CopyTable(string dbConnectionString, string sourceTable, string destinationTable) { - get + using (var sourceConnection = new SqlConnection(dbConnectionString)) { - if (snapshotPath == null) + sourceConnection.Open(); + var commandSourceData = new SqlCommand($"SELECT * FROM {sourceTable};", sourceConnection); + var reader = commandSourceData.ExecuteReader(); + + using (var destinationConnection = new SqlConnection(dbConnectionString)) { - return GetSnapshopPath(); + destinationConnection.Open(); + + using (var bulkCopy = new SqlBulkCopy(destinationConnection)) + { + bulkCopy.DestinationTableName = destinationTable; + try + { + bulkCopy.WriteToServer(reader); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + finally + { + reader.Close(); + } + } } - return snapshotPath; - } - set - { - snapshotPath = CheckForIllegalCharsAndAppendTrailingSlash(value); } } - #endregion - - #region Private Methods - - private static DirectoryInfo CheckForIllegalCharsAndAppendTrailingSlash(DirectoryInfo value) - { - if(value == null) - { - return null; - } - string path = value.FullName; - path = path.Replace("\"", ""); - if(!path.EndsWith(@"\")) - { - path += @"\"; - } - return new DirectoryInfo(path); - } - - private object ExecuteScalar(string sql) + object ExecuteScalar(string sql) { - using (SqlConnection conn = new SqlConnection(connectionString)) + using (var conn = new SqlConnection(connectionString)) { - sql = sql + " --dataProfilerIgnore"; - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; + sql += " --dataProfilerIgnore"; + var cmd = new SqlCommand(sql, conn) { CommandTimeout = 1200 }; conn.Open(); return cmd.ExecuteScalar(); } } - private void ExecuteNonQuery(string sql) + void ExecuteNonQuery(string sql) { - using (SqlConnection conn = new SqlConnection(connectionString)) + using (var conn = new SqlConnection(connectionString)) { - sql = sql + " --dataProfilerIgnore"; - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; - conn.Open(); - cmd.ExecuteNonQuery(); + conn.Open(); + sql += " --dataProfilerIgnore"; + using (var cmd = new SqlCommand(sql, conn) { CommandTimeout = 1200 }) + cmd.ExecuteNonQuery(); } } - private DirectoryInfo GetSnapshopPath() + void ConsoleWrite(string message) { - string dbName = (string) ExecuteScalar("SELECT DB_Name()"); - string mdfFilePath = Path.GetDirectoryName(ExecuteScalar("select filename from sysfiles where filename like '%.MDF%'").ToString().Trim()); - return new DirectoryInfo(string.Format(@"{0}\Snapshot_{1}\", mdfFilePath, dbName)); + if (verbose) + Console.Out.WriteLine(message); } - private void RunSqlScript(StreamReader reader) + void Execute(string actionName, Action action) { - string line = ""; - StringBuilder cmd = new StringBuilder(); - while ((line = reader.ReadLine()) != null) - { - if (line.Trim().ToLower().Equals("go")) - { - ExecuteNonQuery(cmd.ToString()); - cmd.Length = 0; - } - else - { - cmd.Append(line); - cmd.Append(Environment.NewLine); - } - } - if (cmd.ToString().Trim().Length > 0) + var stopWatch = new Stopwatch(); + ConsoleWrite($"{actionName} for {databaseName} started"); + stopWatch.Start(); + try { - ExecuteNonQuery(cmd.ToString()); + action(); + } + finally + { + stopWatch.Stop(); + ConsoleWrite($"{actionName} for {databaseName} complete: {stopWatch.Elapsed}"); } } - private void ConsoleWrite(string message) + void ExecuteForEach(IEnumerable tables, Func func) { - if(this.verbose) + RunStatements(tables.Select(func)); + } + + IReadOnlyCollection SelectTables(string sql) + { + var tables = new List(); + using (var conn = new SqlConnection(connectionString)) { - Console.Out.WriteLine(message); + conn.Open(); + using (var cmd = new SqlCommand(sql, conn)) + using (var reader = cmd.ExecuteReader()) + { + while (reader.Read()) + { + tables.Add(new TableMetadata + { + Schema = reader.GetString(0), + Name = reader.GetString(1) + }); + } + } } + return tables; + } + + void GuardDatabaseIsPrepared() + { + if (!TableExists(ChangeTrackingTableName)) + throw new SqlDataFreshException( + $"DataFresh table ({ChangeTrackingTableName}) not found. Please prepare the database."); + } + + IReadOnlyCollection GetAllTables() + { + var sql = + $@"SELECT table_schema, table_name + FROM Information_Schema.tables + WHERE table_type = 'BASE TABLE' + AND table_name NOT IN ('df_ChangeTracking', 'dr_DeltaVersion') + AND table_name NOT LIKE '%{SnapshotTableSuffix}'"; + + var tables = SelectTables(sql); + return tables; } - #endregion + IReadOnlyCollection GetChangedTables() + { + var sql = + $@"SELECT DISTINCT TableSchema, TableName + FROM df_ChangeTracking + WHERE TableName NOT IN ('df_ChangeTracking', 'dr_DeltaVersion') + AND TableName NOT LIKE '%{SnapshotTableSuffix}'"; + + var tables = SelectTables(sql); + return tables; + } + + IReadOnlyCollection GetChangedAndReferencedTables() + { + var sql = $@" + SELECT DISTINCT x.TableSchema, x.TableName + FROM ( + SELECT DISTINCT TableSchema, TableName + FROM df_ChangeTracking + UNION + SELECT DISTINCT + OBJECT_SCHEMA_NAME(fkeyid) AS TableSchema, + OBJECT_NAME(fkeyid) AS TableName + FROM sysreferences sr + INNER JOIN df_ChangeTracking ct ON sr.rkeyid = OBJECT_ID(ct.TableName) + ) x + WHERE x.TableName NOT IN ('df_ChangeTracking', 'dr_DeltaVersion') + AND x.TableName NOT LIKE '%{SnapshotTableSuffix}' + "; + + var tables = SelectTables(sql); + return tables; + } + + public bool TableExists(string tableName) + { + var tableCount = int.Parse(ExecuteScalar( + $"SELECT COUNT(TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='{tableName}'").ToString()); + return (tableCount > 0); + } } } \ No newline at end of file diff --git a/DataFreshUtil/AssemblyInfo.cs b/DataFreshUtil/AssemblyInfo.cs index 700e112..7219c01 100644 --- a/DataFreshUtil/AssemblyInfo.cs +++ b/DataFreshUtil/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersionAttribute("1.0.0.0")] +[assembly: AssemblyVersionAttribute("2.0.0.0")] [assembly: AssemblyTitleAttribute("dataFresh Console Utility")] - diff --git a/DataFreshUtil/DataFreshUtil.csproj b/DataFreshUtil/DataFreshUtil.csproj index d2d5664..417a58d 100644 --- a/DataFreshUtil/DataFreshUtil.csproj +++ b/DataFreshUtil/DataFreshUtil.csproj @@ -28,7 +28,7 @@ - bin\Debug\ + ..\..\..\Source\Legacy\wwwroot\bin\ false 285212672 false diff --git a/DataFreshUtil/EntryPoint.cs b/DataFreshUtil/EntryPoint.cs index 3abcf8c..63f2ebb 100644 --- a/DataFreshUtil/EntryPoint.cs +++ b/DataFreshUtil/EntryPoint.cs @@ -1,30 +1,30 @@ -// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. -// Please visit us on the web: http://blogs.ent0.com/ -// -// This library is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation; either version 2.1 of the -// License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to: -// Free Software Foundation, Inc., -// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - +// EntropyZero dataFresh Copyright (C) 2007 EntropyZero Consulting, LLC. +// Please visit us on the web: http://blogs.ent0.com/ +// +// This library is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; either version 2.1 of the +// License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to: +// Free Software Foundation, Inc., +// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + using DataFresh; namespace DataFreshUtil { - public class EntryPoint + static class EntryPoint { public static void Main(string[] args) { - DataFreshConsole console = new DataFreshConsole(); + var console = new DataFreshConsole(); console.Start(args); } } diff --git a/EntropyZero DataFresh Solution.sln.DotSettings b/EntropyZero DataFresh Solution.sln.DotSettings new file mode 100644 index 0000000..241eb00 --- /dev/null +++ b/EntropyZero DataFresh Solution.sln.DotSettings @@ -0,0 +1,17 @@ + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/TestHarnessExample/TestFixtureBase.cs b/TestHarnessExample/TestFixtureBase.cs index 9f466d1..4c81fd8 100644 --- a/TestHarnessExample/TestFixtureBase.cs +++ b/TestHarnessExample/TestFixtureBase.cs @@ -53,9 +53,9 @@ public void TearDown() public void ExecuteNonQuery(string sql) { - using (SqlConnection conn = new SqlConnection(connectionString)) + using (var conn = new SqlConnection(connectionString)) { - SqlCommand cmd = new SqlCommand(sql, conn); + var cmd = new SqlCommand(sql, conn); conn.Open(); cmd.ExecuteNonQuery(); } @@ -63,9 +63,9 @@ public void ExecuteNonQuery(string sql) public object ExecuteScalar(string sql) { - using (SqlConnection conn = new SqlConnection(connectionString)) + using (var conn = new SqlConnection(connectionString)) { - SqlCommand cmd = new SqlCommand(sql, conn); + var cmd = new SqlCommand(sql, conn); conn.Open(); return cmd.ExecuteScalar(); } diff --git a/Testing.DataFresh/DataFreshConsoleTester.cs b/Testing.DataFresh/DataFreshConsoleTester.cs index 5f82f18..8c06804 100644 --- a/Testing.DataFresh/DataFreshConsoleTester.cs +++ b/Testing.DataFresh/DataFreshConsoleTester.cs @@ -1,3 +1,4 @@ +using System; using DataFresh; using NUnit.Framework; using System.IO; @@ -14,10 +15,10 @@ public class DataFreshConsoleTester public DataFreshConsoleTester() { var doc = new System.Xml.XmlDocument(); - doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), @"..\..\..\TestConnectionStrings.xml")); - userId = doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText; - password = doc.SelectSingleNode("/connectionStrings/properties/password").InnerText; - server = doc.SelectSingleNode("/connectionStrings/properties/server").InnerText; + doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location) ?? string.Empty, @"..\..\..\TestConnectionStrings.xml")); + userId = doc.SelectSingleNode("/connectionStrings/properties/userId")?.InnerText; + password = doc.SelectSingleNode("/connectionStrings/properties/password")?.InnerText; + server = doc.SelectSingleNode("/connectionStrings/properties/server")?.InnerText; } [SetUp] @@ -35,43 +36,42 @@ public void TearDown() [Test] public void NoArgs() { - string[] args = new string[] { }; - DataFreshConsole console = new DataFreshConsole(); - console.Start(args); + var args = new string[] { }; + var console = new DataFreshConsole(); + Assert.DoesNotThrow(() => console.Start(args)); } [Test] public void BlankArgs() { - string[] args = new string[] { "", "" }; - DataFreshConsole console = new DataFreshConsole(); - console.Start(args); + var args = new[] { "", "" }; + var console = new DataFreshConsole(); + Assert.DoesNotThrow(() => console.Start(args)); } [Test] public void BadCommand() { - DataFreshConsole console = ExecuteDataFreshConsole("BADCOMMAND"); - Assert.IsTrue(console.Results.ToString().IndexOf("Command 'BADCOMMAND' was not recognized") > -1); + var console = ExecuteDataFreshConsole("BADCOMMAND"); + StringAssert.Contains("Command 'BADCOMMAND' was not recognized", console.Results); } [Test] public void PrepareCommand() { - DataFreshConsole console = ExecuteDataFreshConsole("PREPARE"); + Assert.DoesNotThrow(() => ExecuteDataFreshConsole("PREPARE")); } [Test] public void PrepareCommandIgnoreSnapshot() { - DataFreshConsole console = ExecuteDataFreshConsole("PREPARE", "-ignoresnapshot", "1"); - + Assert.DoesNotThrow(() => ExecuteDataFreshConsole("PREPARE", "-ignoresnapshot", "1")); } [Test] public void RefreshCommand() { - ExecuteDataFreshConsole("REFRESH"); + Assert.DoesNotThrow(() => ExecuteDataFreshConsole("REFRESH")); } [Test] @@ -84,30 +84,30 @@ public void RefreshWithoutPrepareCommand() [Test] public void CheckResults() { - DataFreshConsole console = ExecuteDataFreshConsole("REFRESH"); - Assert.IsTrue(console.Results.ToString().IndexOf("Entropy Zero") > -1); + var console = ExecuteDataFreshConsole("REFRESH"); + Assert.IsTrue(console.Results.IndexOf("Entropy Zero", StringComparison.Ordinal) > -1); } [Test] public void PassServerInstanceNameCheckConnectionString() { - string serverInstance = @"localhost\dev"; - DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); - Assert.AreEqual(5, console.arguments.Keys.Count); - Assert.AreEqual(serverInstance, console.arguments["s"]); - string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost\dev;"; - Assert.AreEqual(expectedConnectionString, console.connectionString); + const string serverInstance = @"localhost\dev"; + var console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); + Assert.AreEqual(5, console.Arguments.Keys.Count); + Assert.AreEqual(serverInstance, console.Arguments["s"]); + const string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost\dev;"; + Assert.AreEqual(expectedConnectionString, console.ConnectionString); } [Test] public void PassServerNameCheckConnectionString() { - string serverInstance = @"localhost"; - DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); - Assert.AreEqual(5, console.arguments.Keys.Count); - Assert.AreEqual(serverInstance, console.arguments["s"]); - string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost;"; - Assert.AreEqual(expectedConnectionString, console.connectionString); + const string serverInstance = @"localhost"; + var console = DataFreshConsole.Execute("FOO", "test", "test", serverInstance, "DataFreshSample"); + Assert.AreEqual(5, console.Arguments.Keys.Count); + Assert.AreEqual(serverInstance, console.Arguments["s"]); + const string expectedConnectionString = @"user id=test;password=test;Initial Catalog=DataFreshSample;Data Source=localhost;"; + Assert.AreEqual(expectedConnectionString, console.ConnectionString); } [Test] @@ -115,15 +115,15 @@ public void CheckSnapshotPath() { //-sp "${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData"" //-sp '${CCNetWorkingDirectory}\Web Harmony Solution\Database\Baseline\BaselineData' - string snapshotPath = @"c:\temp"; - DataFreshConsole console = DataFreshConsole.Execute("FOO", "test", "test", "localhost", "DataFreshSample", "-sp", snapshotPath); - Assert.AreEqual(6, console.arguments.Keys.Count); - Assert.AreEqual(snapshotPath, console.arguments["sp"]); + const string snapshotPath = @"c:\temp"; + var console = DataFreshConsole.Execute("FOO", "test", "test", "localhost", "DataFreshSample", "-sp", snapshotPath); + Assert.AreEqual(6, console.Arguments.Keys.Count); + Assert.AreEqual(snapshotPath, console.Arguments["sp"]); } - private DataFreshConsole ExecuteDataFreshConsole(string command, params string[] options) + DataFreshConsole ExecuteDataFreshConsole(string command, params string[] options) { - DataFreshConsole console = DataFreshConsole.Execute(command, userId, password, server, "DataFreshSample", options); + var console = DataFreshConsole.Execute(command, userId, password, server, "DataFreshSample", options); return console; } } diff --git a/Testing.DataFresh/SqlDataFreshTester.cs b/Testing.DataFresh/SqlDataFreshTester.cs index 402f645..1eeb6a3 100644 --- a/Testing.DataFresh/SqlDataFreshTester.cs +++ b/Testing.DataFresh/SqlDataFreshTester.cs @@ -10,108 +10,43 @@ namespace Testing.DataFresh public class SqlDataFreshTester : TestFixtureBase { [Test] - public void PrepDatabaseforDataFresh_NoConnectionString() + public void PrepDatabaseForDataFresh_NoConnectionString() { - SqlDataFresh dataFresh = new SqlDataFresh(null); - Assert.Throws(() => dataFresh.PrepareDatabaseforDataFresh(), "The ConnectionString property has not been initialized."); + var dataFresh = new SqlDataFresh(null); + Assert.Throws(() => dataFresh.PrepareDatabaseForDataFresh(), "The ConnectionString property has not been initialized."); } - [Test] - public void Encrypt() - { -// string key = "pass@word1"; -// -// string enc = ResourceManagement.Encrypt("test", key); -// Assert.AreEqual("test", ResourceManagement.Decrypt(enc, key)); - -// ResourceManagement.Encrypt(@"C:\development\dataFresh\DataFresh\Resources\PrepareDataFresh.sql", -// @"C:\development\dataFresh\DataFresh\Resources\PrepareDataFresh.sql.enc", key); - -// byte[] dec = ResourceManagement.GetDecryptedResourceBytes("DataFresh.Resources.PrepareDataFresh.sql.enc"); -// string decStr = System.Text.Encoding.ASCII.GetString(dec); -// Console.Out.WriteLine("decStr = {0}", decStr); - -// string str = ResourceManagement.GetDecryptedResource("DataFresh.Resources.PrepareDataFresh.sql"); -// Console.Out.WriteLine("str = {0}", str); - } - [Test] public void RemoveDataFresh() { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + var dataFresh = new SqlDataFresh(connectionString); dataFresh.RemoveDataFreshFromDatabase(); - Assert.IsFalse(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); - } - + Assert.IsFalse(dataFresh.TableExists(SqlDataFresh.ChangeTrackingTableName)); + } + [Test] - public void PrepDatabaseforDataFresh() + public void PrepDatabaseForDataFresh() { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + var dataFresh = new SqlDataFresh(connectionString); dataFresh.RemoveDataFreshFromDatabase(); - Assert.IsFalse(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); - Assert.IsFalse(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); - - dataFresh.PrepareDatabaseforDataFresh(); - Assert.IsTrue(dataFresh.TableExists(dataFresh.ChangeTrackingTableName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.ExtractProcedureName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.ImportProcedureName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.PrepareProcedureName)); - Assert.IsTrue(dataFresh.ProcedureExists(dataFresh.RefreshProcedureName)); - } - - [Test] - public void SnapshopPath_ManualOverride() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - DirectoryInfo tempPath = new DirectoryInfo(Path.GetTempPath()); - dataFresh.SnapshotPath = tempPath; - Console.Out.WriteLine("dataFresh.SnapshotPath.FullName = {0}", dataFresh.SnapshotPath.FullName); - Assert.AreEqual(tempPath.FullName, dataFresh.SnapshotPath.FullName); - } - - [Test] - public void SnapshopPath_ManualOverrideTrailingBackslash() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - string tempPath = @"c:\temp\folder"; - dataFresh.SnapshotPath = new DirectoryInfo(tempPath); - Assert.AreEqual(@"c:\temp\folder\", dataFresh.SnapshotPath.FullName); - } + Assert.IsFalse(dataFresh.TableExists(SqlDataFresh.ChangeTrackingTableName)); - [Test] - public void SnapshopPath_Resetting() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.SnapshotPath = null; - Assert.IsTrue(dataFresh.SnapshotPath.FullName.IndexOf("Snapshot_DataFreshSample") > -1); - } - - [Test] - public void SnapshopPath() - { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - Assert.IsTrue(dataFresh.SnapshotPath.FullName.IndexOf("Snapshot_DataFreshSample") > -1); + dataFresh.PrepareDatabaseForDataFresh(); + Assert.IsTrue(dataFresh.TableExists(SqlDataFresh.ChangeTrackingTableName)); } [Test] public void IdentityReseedDuringRefresh() { InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.PrepareDatabaseforDataFresh(true); - int id = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); + var dataFresh = new SqlDataFresh(connectionString); + dataFresh.PrepareDatabaseForDataFresh(); + var id = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); Assert.AreEqual(6, id); dataFresh.RefreshTheDatabase(); - int id2 = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); + var id2 = Convert.ToInt32(ExecuteScalar("insert into author (lastname, firstname) values ('brockey', 'mike'); select @@identity;")); Assert.AreEqual(6, id2); } @@ -119,14 +54,14 @@ public void IdentityReseedDuringRefresh() public void IdentityReseedDuringRefresh_TableWithNoRows() { InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); - dataFresh.PrepareDatabaseforDataFresh(true); - int id = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); + var dataFresh = new SqlDataFresh(connectionString); + dataFresh.PrepareDatabaseForDataFresh(); + var id = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); Assert.AreEqual(1, id); dataFresh.RefreshTheDatabase(); - int id2 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); + var id2 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world'); select @@identity;")); Assert.AreEqual(1, id2); - int id3 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world 2'); select @@identity;")); + var id3 = Convert.ToInt32(ExecuteScalar("insert into movie (title) values ('mike brockey takes over the world 2'); select @@identity;")); Assert.AreEqual(2, id3); } @@ -134,30 +69,30 @@ public void IdentityReseedDuringRefresh_TableWithNoRows() public void IdentityReseedDuringRefresh_TableWithNoRows2() { InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + var dataFresh = new SqlDataFresh(connectionString); dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); + dataFresh.PrepareDatabaseForDataFresh(); ExecuteNonQuery("insert into movie2 (movieid, title) values (1, 'mike brockey takes over the world');"); - dataFresh.RefreshTheDatabase(); - } - + Assert.DoesNotThrow(() => dataFresh.RefreshTheDatabase()); + } + [Test] public void IdentityReseedWorksWithTablesThatUseReservedWords() { InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + var dataFresh = new SqlDataFresh(connectionString); dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); + dataFresh.PrepareDatabaseForDataFresh(); ExecuteNonQuery("insert into [check] (title) values ('mike brockey takes over the world');"); - dataFresh.RefreshTheDatabase(); - } - + Assert.DoesNotThrow(() => dataFresh.RefreshTheDatabase()); + } + [Test] public void RefreshTheDatabaseSpeedTests() { - SqlDataFresh dataFresh = new SqlDataFresh(connectionString, true); + var dataFresh = new SqlDataFresh(connectionString, true); dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); + dataFresh.PrepareDatabaseForDataFresh(); ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); dataFresh.RefreshTheDatabase(); ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); @@ -297,29 +232,29 @@ public void RefreshTheDatabaseSpeedTests() ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); dataFresh.RefreshTheDatabase(); ExecuteNonQuery("insert into author (lastname, firstname) values ('brockey', 'mike');"); - dataFresh.RefreshTheDatabase(); + Assert.DoesNotThrow(() => dataFresh.RefreshTheDatabase()); } [Test] public void ShouldNotRefreshDeltaRunnerTable() { InitializeTheDatabase(); - SqlDataFresh dataFresh = new SqlDataFresh(connectionString); + var dataFresh = new SqlDataFresh(connectionString); dataFresh.RemoveDataFreshFromDatabase(); - dataFresh.PrepareDatabaseforDataFresh(true); + dataFresh.PrepareDatabaseForDataFresh(); ExecuteNonQuery("insert into [dr_deltaversion] ([latestdelta], [hash], [filename]) values (99, 'blah-hash', 'whatever file');"); Assert.AreEqual(1, ExecuteScalar("select count(*) from [dr_deltaversion] where [filename] = 'whatever file'")); dataFresh.RefreshTheDatabase(); Assert.AreEqual(1, ExecuteScalar("select count(*) from [dr_deltaversion] where [filename] = 'whatever file'")); } - private void InitializeTheDatabase() - { - var binDir = Path.GetDirectoryName(GetType().Assembly.Location); - SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, Path.Combine(binDir, deltaPath), true); + void InitializeTheDatabase() + { + var binDir = Path.GetDirectoryName(GetType().Assembly.Location) ?? string.Empty; + var deltaRunner = new SqlDeltaRunner(connectionString, Path.Combine(binDir, deltaPath), true); deltaRunner.PrepareForDeltaRunner(); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "Database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "Setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "Database.sql")), SqlFileExecutionOption.ExecuteBeforeDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "Setup.sql")), SqlFileExecutionOption.ExecuteAfterDeltas); deltaRunner.ApplyDeltas(); } } diff --git a/Testing.DataFresh/TestFixtureBase.cs b/Testing.DataFresh/TestFixtureBase.cs index 41e1f3e..10fb675 100644 --- a/Testing.DataFresh/TestFixtureBase.cs +++ b/Testing.DataFresh/TestFixtureBase.cs @@ -10,52 +10,51 @@ public class TestFixtureBase public readonly string connectionString; public readonly string connectionStringMaster; public static string databaseFilesPath = @"..\..\Database Files"; - public static string deltaPath = @"..\..\Database Files\Deltas"; - - public TestFixtureBase() - { - var doc = new System.Xml.XmlDocument(); - doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), @"..\..\..\TestConnectionStrings.xml")); - connectionString = connectionString = - string.Format(doc.SelectSingleNode("/connectionStrings/sqlDataFreshSampleConnectionStringTemplate").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/password").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/server").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/pooling").InnerText); - connectionStringMaster = - string.Format(doc.SelectSingleNode("/connectionStrings/sqlMasterDatabaseConnectionStringTemplate").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/userId").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/password").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/server").InnerText, - doc.SelectSingleNode("/connectionStrings/properties/pooling").InnerText); - } + public static string deltaPath = @"..\..\Database Files\Deltas"; + + public TestFixtureBase() + { + var doc = new System.Xml.XmlDocument(); + doc.Load(Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location) ?? string.Empty, @"..\..\..\TestConnectionStrings.xml")); + connectionString = connectionString = + string.Format(doc.SelectSingleNode("/connectionStrings/sqlDataFreshSampleConnectionStringTemplate")?.InnerText ?? string.Empty, + doc.SelectSingleNode("/connectionStrings/properties/userId")?.InnerText, + doc.SelectSingleNode("/connectionStrings/properties/password")?.InnerText, + doc.SelectSingleNode("/connectionStrings/properties/server")?.InnerText, + doc.SelectSingleNode("/connectionStrings/properties/pooling")?.InnerText); + connectionStringMaster = + string.Format(doc.SelectSingleNode("/connectionStrings/sqlMasterDatabaseConnectionStringTemplate")?.InnerText ?? string.Empty, + doc.SelectSingleNode("/connectionStrings/properties/userId")?.InnerText, + doc.SelectSingleNode("/connectionStrings/properties/password")?.InnerText, + doc.SelectSingleNode("/connectionStrings/properties/server")?.InnerText, + doc.SelectSingleNode("/connectionStrings/properties/pooling")?.InnerText); + } - [SetUp] + [SetUp] public void SetUp() { SqlDeltaRunner.CreateDatabase("DataFreshSample", connectionStringMaster, true); DeltaRunnerInstance.ApplyDeltas(); - } - + } + public SqlDeltaRunner DeltaRunnerInstance { get - { - var binDir = Path.GetDirectoryName(GetType().Assembly.Location); - SqlDeltaRunner deltaRunner = new SqlDeltaRunner(connectionString, Path.Combine(binDir, deltaPath), true); + { + var binDir = Path.GetDirectoryName(GetType().Assembly.Location) ?? string.Empty; + var deltaRunner = new SqlDeltaRunner(connectionString, Path.Combine(binDir, deltaPath), true); deltaRunner.PrepareForDeltaRunner(); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "database.sql")),SqlFileExecutionOption.ExecuteBeforeDeltas); - deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "setup.sql")),SqlFileExecutionOption.ExecuteAfterDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "database.sql")), SqlFileExecutionOption.ExecuteBeforeDeltas); + deltaRunner.AddSqlFile(new FileInfo(Path.Combine(binDir, databaseFilesPath, "setup.sql")), SqlFileExecutionOption.ExecuteAfterDeltas); return deltaRunner; } - } - + } + public void ExecuteNonQuery(string sql) { - using (SqlConnection conn = new SqlConnection(connectionString)) + using (var conn = new SqlConnection(connectionString)) { - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; + var cmd = new SqlCommand(sql, conn) { CommandTimeout = 1200 }; conn.Open(); cmd.ExecuteNonQuery(); } @@ -63,10 +62,9 @@ public void ExecuteNonQuery(string sql) public object ExecuteScalar(string sql) { - using (SqlConnection conn = new SqlConnection(connectionString)) + using (var conn = new SqlConnection(connectionString)) { - SqlCommand cmd = new SqlCommand(sql, conn); - cmd.CommandTimeout = 1200; + var cmd = new SqlCommand(sql, conn) { CommandTimeout = 1200 }; conn.Open(); return cmd.ExecuteScalar(); } From 7b2685dce524a5735ab3006f2f4b699f84b0e381 Mon Sep 17 00:00:00 2001 From: Dmytro Pryvedeniuk Date: Thu, 15 Oct 2020 17:02:27 +0300 Subject: [PATCH 13/13] [DEVLEAD-3700] Correct output path --- DataFresh.Common/DataFresh.Common.csproj | 2 +- DataFreshUtil/DataFreshUtil.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DataFresh.Common/DataFresh.Common.csproj b/DataFresh.Common/DataFresh.Common.csproj index 1f18ba2..0f28634 100644 --- a/DataFresh.Common/DataFresh.Common.csproj +++ b/DataFresh.Common/DataFresh.Common.csproj @@ -28,7 +28,7 @@ - ..\..\..\Source\Legacy\wwwroot\bin\ + bin\Debug\ false 285212672 false diff --git a/DataFreshUtil/DataFreshUtil.csproj b/DataFreshUtil/DataFreshUtil.csproj index 417a58d..d2d5664 100644 --- a/DataFreshUtil/DataFreshUtil.csproj +++ b/DataFreshUtil/DataFreshUtil.csproj @@ -28,7 +28,7 @@ - ..\..\..\Source\Legacy\wwwroot\bin\ + bin\Debug\ false 285212672 false