public void Execute_ShortWithTimeout_SqlException() { var etl = new EtlXml() { Server = ConnectionStringReader.GetIntegrationServer(), Catalog = "SSISDB", Folder = "Demo.NBi.Ssis", Project = "Demo.NBi.Ssis.Integration", Name = "Dimensions.dtsx", Timeout = 1 }; etl.InternalParameters.Add(new EtlParameterXml() { Name = "FlatFileScientist", StringValue = $@"{AssemblyDirectory}\data\DimScientist.csv" }); etl.InternalParameters.Add(new EtlParameterXml() { Name = "FlatFileGeography", StringValue = $@"{AssemblyDirectory}\data\DimGeography.csv" }); etl.InternalParameters.Add(new EtlParameterXml() { Name = "ConnectionString", StringValue = ConnectionStringReader.GetIntegrationServerTargetDatabase() }); var runner = new EtlCatalogRunner(etl); Assert.Throws <SqlException>(() => runner.Execute()); }
public void Execute_WithoutTimeout_CorrectlyHandled() { var etl = new EtlXml() { Server = ConnectionStringReader.GetIntegrationServer(), Catalog = "SSISDB", Folder = "Demo.NBi.Ssis", Project = "Demo.NBi.Ssis.Integration", Name = "Dimensions.dtsx", }; etl.InternalParameters.Add(new EtlParameterXml() { Name = "FlatFileScientist", StringValue = $@"{AssemblyDirectory}\data\DimScientist.csv" }); etl.InternalParameters.Add(new EtlParameterXml() { Name = "FlatFileGeography", StringValue = $@"{AssemblyDirectory}\data\DimGeography.csv" }); etl.InternalParameters.Add(new EtlParameterXml() { Name = "ConnectionString", StringValue = ConnectionStringReader.GetIntegrationServerTargetDatabase() }); var runner = new EtlCatalogRunner(etl); runner.Execute(); }
public void Execute_ExistingSamplePackageWithParameter_SuccessAndParameterUsed() { var destPath = DiskOnFile.GetDirectoryPath() + "SampleFile.txt"; if (File.Exists(destPath)) { File.Delete(destPath); } var etl = new EtlXml(); etl.Path = @"Etl\"; etl.Name = "Sample.dtsx"; etl.Password = "******"; var param = new EtlParameterXml(); param.Name = "DestinationPath"; param.StringValue = destPath; etl.InternalParameters.Add(param); var runner = new EtlFileRunner(etl); var result = runner.Run(); Assert.That(result.IsSuccess, Is.True); Assert.That(File.Exists(destPath), Is.True); }
public void Execute_ExistingSamplePackageWithParameterWithInvalidValue_FailureWithMessage() { var destPath = DiskOnFile.GetDirectoryPath() + @"\/.txt"; if (File.Exists(destPath)) { File.Delete(destPath); } var etl = new EtlXml(); etl.Path = @"Etl\"; etl.Name = "Sample.dtsx"; etl.Password = "******"; var param = new EtlParameterXml(); param.Name = "DestinationPath"; param.StringValue = destPath; etl.InternalParameters.Add(param); var runner = new EtlFileRunner(etl); var result = runner.Run(); Assert.That(result.IsSuccess, Is.False); Assert.That(result.Message, Is.StringContaining("invalid characters")); }
public void Execute_ExistingSamplePackageWithVariable_SuccessAndParameterUsed() { var limitValue = 5; var destPath = DiskOnFile.GetDirectoryPath() + "VariableFile.txt"; if (File.Exists(destPath)) { File.Delete(destPath); } var etl = new EtlXml(); etl.Path = @"Etl\"; etl.Name = "Sample.dtsx"; etl.Password = "******"; var param = new EtlParameterXml(); param.Name = "DestinationPath"; param.StringValue = destPath; etl.InternalParameters.Add(param); var variable = new EtlParameterXml(); variable.Name = "User::Limit"; variable.StringValue = String.Format("top {0} *", limitValue); etl.InternalParameters.Add(variable); var runner = new EtlFileRunner(etl); var result = runner.Run(); Assert.That(result.IsSuccess, Is.True); Assert.That(File.Exists(destPath), Is.True); var content = File.ReadAllLines(destPath); Assert.That(content.Count(), Is.EqualTo(limitValue + 1)); }