public void CleanUpSchema() { //Arrange string schemaName = "s" + HashHelper.RandomString(9); SqlTask.ExecuteNonQuery(Connection, "Create schema", $"CREATE SCHEMA {schemaName}"); SqlTask.ExecuteNonQuery(Connection, "Create table", $"CREATE TABLE {schemaName}.Table1 ( Nothing INT NULL )"); SqlTask.ExecuteNonQuery(Connection, "Create view", $"CREATE VIEW {schemaName}.View1 AS SELECT * FROM {schemaName}.Table1"); SqlTask.ExecuteNonQuery(Connection, "Create procedure", $"CREATE PROCEDURE {schemaName}.Proc1 AS SELECT * FROM {schemaName}.Table1"); var objCountSql = new SqlTask("Count object", $@"SELECT COUNT(*) FROM sys.objects obj INNER JOIN sys.schemas sch ON sch.schema_id = obj.schema_id WHERE sch.name = '{schemaName}'") { ConnectionManager = Connection }; Assert.Equal(3, objCountSql.ExecuteScalar <int>()); //Act CleanUpSchemaTask.CleanUp(Connection, schemaName); //Assert Assert.Equal(0, objCountSql.ExecuteScalar <int>()); }
public AzureSqlTests(DataFlowDatabaseFixture dbFixture) { CleanUpSchemaTask.CleanUp(AzureSqlConnection, "[source]"); CleanUpSchemaTask.CleanUp(AzureSqlConnection, "[dest]"); CreateSchemaTask.Create(AzureSqlConnection, "[source]"); CreateSchemaTask.Create(AzureSqlConnection, "[dest]"); }
public void TestCleanUpSchema() { string schemaName = "s" + TestHelper.RandomString(9); SqlTask.ExecuteNonQuery("Create schema", $"create schema {schemaName}"); SqlTask.ExecuteNonQuery("Create schema", $"create table {schemaName}.Table1 ( Nothing int null )"); SqlTask.ExecuteNonQuery("Create schema", $"create view {schemaName}.View1 as select * from {schemaName}.Table1"); SqlTask.ExecuteNonQuery("Create schema", $"create procedure {schemaName}.Proc1 as select * from {schemaName}.Table1"); var objCountSql = new SqlTask("Count object", $@"select count(*) from sys.objects obj inner join sys.schemas sch on sch.schema_id = obj.schema_id where sch.name = '{schemaName}'"); Assert.AreEqual(3, objCountSql.ExecuteScalar <int>()); CleanUpSchemaTask.CleanUp(schemaName); Assert.AreEqual(0, objCountSql.ExecuteScalar <int>()); }
public void CleanupETLLogTablesWhileLogging() { //Arrange CreateLogTablesTask.CreateLog(Connection); Assert.Equal(1, RowCountTask.Count(Connection, "sys.tables", $"type = 'U' AND name = 'Log' AND schema_id('etl') = schema_id")); Assert.Equal(1, RowCountTask.Count(Connection, "sys.tables", $"type = 'U' AND name = 'LoadProcess' AND schema_id('etl') = schema_id")); //Act CleanUpSchemaTask.CleanUp(Connection, "etl"); //Assert Assert.Equal(0, RowCountTask.Count(Connection, "sys.tables", $"type = 'U' AND name = 'Log' AND schema_id('etl') = schema_id")); Assert.Equal(0, RowCountTask.Count(Connection, "sys.tables", $"type = 'U' AND name = 'LoadProcess' AND schema_id('etl') = schema_id")); }
public void TestCleanupETLLogTables() { CreateLogTablesTask.CreateLog(); Assert.IsTrue(new SqlTask("Check etl.Log table", $"select count(*) from sys.tables where type = 'U' and name = 'Log' and schema_id('etl') = schema_id") { DisableLogging = true }.ExecuteScalarAsBool()); Assert.IsTrue(new SqlTask("Check etl.LoadProcess table", $"select count(*) from sys.tables where type = 'U' and name = 'LoadProcess' and schema_id('etl') = schema_id") { DisableLogging = true }.ExecuteScalarAsBool()); CleanUpSchemaTask.CleanUp("etl"); Assert.IsFalse(new SqlTask("Check etl.Log table", $"select count(*) from sys.tables where type = 'U' and name = 'Log' and schema_id('etl') = schema_id") { DisableLogging = true }.ExecuteScalarAsBool()); Assert.IsFalse(new SqlTask("Check etl.LoadProcess table", $"select count(*) from sys.tables where type = 'U' and name = 'LoadProcess' and schema_id('etl') = schema_id") { DisableLogging = true }.ExecuteScalarAsBool()); }
public void TestInit() { CleanUpSchemaTask.CleanUp("test"); }
public void NotSupportedWithSQLite() { Assert.Throws <ETLBoxNotSupportedException>( () => CleanUpSchemaTask.CleanUp(SQLiteConnection, "Test") ); }
public static void CleanUpOracle(string section) { var connManager = Config.OracleConnection.ConnectionManager(section); CleanUpSchemaTask.CleanUp(connManager); }
public void NotSupportedWithOtherDBs() { Assert.Throws <ETLBoxNotSupportedException>( () => CleanUpSchemaTask.CleanUp(Config.SQLiteConnection.ConnectionManager("ControlFlow"), "Test") ); }