Example #1
0
        private void ExecutePackageButton_Click(object sender, EventArgs e)
        {
            try
            {
                Server server = new Server(_server);


                IntegrationServices isServer = new IntegrationServices(server);

                Catalog catalog = isServer.Catalogs["SSISDB"];

                CatalogFolder folder = catalog.Folders["ProSSIS"];

                ProjectInfo p = folder.Projects["My ProSSIS Project"];

                Microsoft.SqlServer.Management.IntegrationServices.PackageInfo pkg = p.Packages["package.dtsx"];
                EnvironmentReference reference = p.References["Environment1", folder.Name];
                reference.Refresh();

                long operationId = pkg.Execute(false, reference);

                catalog.Operations.Refresh();
                StringBuilder messages = new StringBuilder();

                foreach (Operation op in catalog.Operations)
                {
                    if (op.Id == operationId)
                    {
                        op.Refresh();

                        foreach (OperationMessage msg in op.Messages)
                        {
                            messages.AppendLine(msg.Message);
                        }
                    }
                }

                LogFileTextbox.Text = "Package executed: " + messages.ToString();

                //MessageBox.Show("Package executed");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public override DTSExecResult Execute(Connections connections,
                                              VariableDispenser variableDispenser,
                                              IDTSComponentEvents componentEvents,
                                              IDTSLogging log,
                                              object transaction)
        {
            //return base.Execute(connections, variableDispenser, componentEvents, log, transaction);
            Server catalogServer = new Server(ServerName);
            IntegrationServices integrationServices = new IntegrationServices(catalogServer);
            Catalog             catalog             = integrationServices.Catalogs[PackageCatalog];
            CatalogFolder       catalogFolder       = catalog.Folders[PackageFolder];
            ProjectInfo         catalogProject      = catalogFolder.Projects[PackageProject];

            Microsoft.SqlServer.Management.IntegrationServices.PackageInfo catalogPackage = catalogProject.Packages[PackageName + ".dtsx"];

            catalogPackage.Execute(false, null);

            return(DTSExecResult.Success);
        }
        public void TestFlatFileToTableTask()
        {
            string[]      args = { };
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString);

            conn.Open();
            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[Log]"
                              + " WHERE [Log].[QueueID] IN"
                              + " (SELECT QueueID FROM [CHEF].[RequestQueue]"
                              + " WHERE ProcessID = 9500)";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[RequestQueue]"
                              + " WHERE ProcessID = 9500";
            cmd.ExecuteNonQuery();
            cmd.CommandText = "DELETE FROM [Chef].[MetaData]"
                              + " WHERE ProcessID = 9500";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "INSERT INTO [CHEF].[Metadata] VALUES "
                              + "(9500"
                              + ",'FlatFileToTableTaskTest'"
                              + ",'<CHEFMetaData ApplicationName=\"TestApplication\">"
                              + "     <Process ID=\"9500\" Name=\"DemoFlatFileToTable\" DefaultAllowTruncate=\"False\" VerboseLogging=\"False\" ExecuteExistingPackage=\"False\" >"
                              + "         <ConnectionSet>"
                              + "             <SQLConnection key=\"SQLConnection\" ServerName=\"(local)\" DatabaseName=\"AdventureWorks2012\" />"
                              + "             <FlatFileConnection key=\"FlatFileConnection\" FileName=\"C:\\Users\\t-satsen\\Desktop\" />"
                              + "         </ConnectionSet>"
                              + "         <Step ID=\"9510\" Name=\"SQL Query To Table Test\" TypeID=\"1\" TypeName=\"Staging\">"
                              + "                 <DataFlowSet Name=\"FlatFileToTable\" SourceConnection=\"FlatFileConnection\" TargetConnection=\"SQLConnection\" SourceType=\"FlatFile\" TargetType=\"Table\" PickColumnsFromTarget=\"True\" ColumnDelimeter=\",\" RowDelimeter=\"{CR}{LF}\" IsColumnNamesInFirstDataRow=\"True\" RunParallel=\"True\" AllowFlatFileTruncate=\"False\" TruncateOrDeleteBeforeInsert=\"Truncate\" DeleteFilterClause=\"\" >"
                              + "                 <DataFlow Name=\"TestFile1\" SourceName=\"MyFlatFile.txt\" TargetName=\"Sales.CustomerCOPY\" />"
                              + "             </DataFlowSet>"
                              + "         </Step>"
                              + "     </Process>"
                              + "</CHEFMetaData>'"
                              + ",0"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME()"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME())";
            cmd.ExecuteNonQuery();
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ProcessID", 9500);
            cmd.Parameters.AddWithValue("@StartStepID", 9510);
            cmd.Parameters.AddWithValue("@RequestStatus", 1);
            cmd.CommandText = "CHEF.InsertRequestQueue";
            cmd.ExecuteNonQuery();

            Program_Accessor.WraperCreateSSISPkg(args);

            cmd.Parameters.Clear();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "DELETE FROM [CHEF].[RequestQueue] WHERE [QueueID] = (SELECT MAX(QueueID) FROM [CHEF].[RequestQueue] WHERE [ProcessID] = 9500)";
            cmd.ExecuteNonQuery();
            string serverName    = ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString.Split(';')[1];
            int    index         = serverName.IndexOf('=');
            int    finalStatusID = 4;
            bool   testPass      = true;

            serverName = serverName.Substring(index + 1);
            Server server = new Server(serverName);
            IntegrationServices integrationServices = new IntegrationServices(server);

            Microsoft.SqlServer.Management.IntegrationServices.PackageInfo packageInfo = null;
            ProjectInfo projectInfo = integrationServices.Catalogs["SSISDB"].Folders["CHEFFolder"].Projects["9500_FlatFileToTableTaskTest"];

            Assert.IsNotNull(projectInfo);
            packageInfo = projectInfo.Packages["Package.dtsx"];
            Assert.IsNotNull(packageInfo);
            packageInfo.Execute(false, null);
            Thread.Sleep(1000);
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "SELECT MAX([StatusID])"
                              + " FROM [CHEF].[Log]"
                              + " WHERE [QueueID] ="
                              + " (SELECT [QueueID]"
                              + " FROM [CHEF].[RequestQueue]"
                              + " WHERE [ProcessID] = 9500)";
            SqlDataReader sqlDataReader = cmd.ExecuteReader();

            if (sqlDataReader.HasRows)
            {
                sqlDataReader.Read();
                finalStatusID = Convert.ToInt32(sqlDataReader[0].ToString());
            }
            if (finalStatusID == 4)
            {
                testPass = false;
            }
            sqlDataReader.Close();
            if (testPass)
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 2"
                                  + " WHERE [ProcessID] = 9500";
                cmd.ExecuteNonQuery();
            }
            else
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 4"
                                  + " WHERE [ProcessID] = 9500";
                cmd.ExecuteNonQuery();
            }
            Assert.IsTrue(testPass);
        }
Example #4
0
        public void TestMailTask()
        {
            string[]      args = { };
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString);

            conn.Open();
            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[Log]"
                              + " WHERE [Log].[QueueID] IN"
                              + " (SELECT QueueID FROM [CHEF].[RequestQueue]"
                              + " WHERE ProcessID = 9200)";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[RequestQueue]"
                              + " WHERE ProcessID = 9200";
            cmd.ExecuteNonQuery();
            cmd.CommandText = "DELETE FROM [Chef].[MetaData]"
                              + " WHERE ProcessID = 9200";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "INSERT INTO [CHEF].[Metadata] VALUES "
                              + "(9200"
                              + ",'MailTaskTest'"
                              + ",'<CHEFMetaData ApplicationName=\"TestApplication\">"
                              + "     <Process ID=\"9200\" Name=\"DemoMailTask\" DefaultAllowTruncate=\"False\" VerboseLogging=\"False\" ExecuteExistingPackage=\"False\" >"
                              + "         <ConnectionSet>"
                              + "             <SMTPConnection key=\"SMTPConnection\" SmtpServer=\"mail.messaging.microsoft.com\" UseWindowsAuthentication=\"True\" EnableSsl=\"False\" />"
                              + "         </ConnectionSet>"
                              + "         <Step ID=\"9210\" Name=\"SendMailTask Test\" TypeID=\"1\" TypeName=\"Staging\">"
                              + "             <SendMailTask Name=\"SendMail\" SMTPServer=\"SMTPConnection\" From=\"[email protected]\" To=\"[email protected]\" CC=\"[email protected]\" BCC=\"[email protected]\" Subject=\"Test Mail: Send Mail Task\" Priority=\"Normal\" MessageSourceType=\"DirectInput\" MessageSource=\"Hi, this is mail task test. Please ignore.\">"
                              + "                 <DataFlow Name=\"Populate Sales Currency\" SourceName=\"[Sales].[Currency]\" TargetName=\"[Sales].[Currency_Copy]\" />"
                              + "                 <Attachments FileName=\"C:\\Users\\t-satsen\\Desktop\\Note.txt\" />"
                              + "             </SendMailTask>"
                              + "         </Step>"
                              + "     </Process>"
                              + "</CHEFMetaData>'"
                              + ",0"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME()"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME())";
            cmd.ExecuteNonQuery();
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ProcessID", 9200);
            cmd.Parameters.AddWithValue("@StartStepID", 9210);
            cmd.Parameters.AddWithValue("@RequestStatus", 1);
            cmd.CommandText = "CHEF.InsertRequestQueue";
            cmd.ExecuteNonQuery();

            Program_Accessor.WraperCreateSSISPkg(args);

            cmd.Parameters.Clear();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "DELETE FROM [CHEF].[RequestQueue] WHERE [QueueID] = (SELECT MAX(QueueID) FROM [CHEF].[RequestQueue] WHERE [ProcessID] = 9200)";
            cmd.ExecuteNonQuery();

            string serverName    = ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString.Split(';')[1];
            int    index         = serverName.IndexOf('=');
            int    finalStatusID = 4;
            bool   testPass      = true;

            serverName = serverName.Substring(index + 1);
            Server server = new Server(serverName);
            IntegrationServices integrationServices = new IntegrationServices(server);

            Microsoft.SqlServer.Management.IntegrationServices.PackageInfo packageInfo = null;
            ProjectInfo projectInfo = integrationServices.Catalogs["SSISDB"].Folders["CHEFFolder"].Projects["9200_MailTaskTest"];

            Assert.IsNotNull(projectInfo);
            packageInfo = projectInfo.Packages["Package.dtsx"];
            Assert.IsNotNull(packageInfo);
            packageInfo.Execute(false, null);
            Thread.Sleep(1000);
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "SELECT MAX([StatusID])"
                              + " FROM [CHEF].[Log]"
                              + " WHERE [QueueID] ="
                              + " (SELECT [QueueID]"
                              + " FROM [CHEF].[RequestQueue]"
                              + " WHERE [ProcessID] = 9200)";
            SqlDataReader sqlDataReader = cmd.ExecuteReader();

            if (sqlDataReader.HasRows)
            {
                sqlDataReader.Read();
                finalStatusID = Convert.ToInt32(sqlDataReader[0].ToString());
            }
            if (finalStatusID == 4)
            {
                testPass = false;
            }
            sqlDataReader.Close();
            if (testPass)
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 2"
                                  + " WHERE [ProcessID] = 9200";
                cmd.ExecuteNonQuery();
            }
            else
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 4"
                                  + " WHERE [ProcessID] = 9200";
                cmd.ExecuteNonQuery();
            }
            Assert.IsTrue(testPass);
        }
Example #5
0
        public void TestSQLTask()
        {
            string[] args     = { };
            string   metadata = "<CHEFMetaData ApplicationName=\"TestApplication\">";

            metadata += "<Process ID=\"9100\" Name=\"DemoSQL\" DefaultAllowTruncate=\"False\" VerboseLogging=\"False\" ExecuteExistingPackage=\"False\" >";
            metadata += "<ConnectionSet>";
            metadata += "<SQLConnection key=\"SQLConnection\" ServerName=\"(local)\" DatabaseName=\"AdventureWorks2012\" />";
            metadata += "</ConnectionSet>";
            metadata += "<Variables>";
            metadata += "<Variable Name=\"vTID\" DataType=\"String\" Value=\"0\" />";
            metadata += "</Variables>";
            metadata += "<SetVariables>";
            metadata += "<SetVariable TargetConnection=\"SQLConnection\" SQLStatement= \"SELECT CAST([TerritoryID] AS char(1)) FROM [AdventureWorks2012].[Sales].[SalesTerritory] WHERE [CountryRegionCode] = \'\'CA\'\'\">";
            metadata += "<ResultSet VariableName=\"vTID\" Order=\"0\" />";
            metadata += "</SetVariable>";
            metadata += "</SetVariables>";
            metadata += "<Step ID=\"9110\" Name=\"SQLTaskTest\" TypeID=\"1\" TypeName=\"Staging\" Description=\"This is to demo update\">";
            metadata += "<SQLTaskSet Name=\"SQLTaskSet\" TargetConnection=\"SQLConnection\" RunParallel=\"False\">";
            metadata += "<SQLTask Name=\"SQLTask\" SQLStatement=\"UPDATE [Sales].[SalesPerson] SET Bonus = Bonus+10000 WHERE TerritoryID = CAST(\'\'&quot;+@[CHEF::vTID]+&quot;\'\' as int)\" />";
            metadata += "</SQLTaskSet>";
            metadata += "</Step>";
            metadata += "</Process>";
            metadata += "</CHEFMetaData>";
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString);

            conn.Open();
            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[Log]"
                              + " WHERE [Log].[QueueID] IN"
                              + " (SELECT QueueID FROM [CHEF].[RequestQueue]"
                              + " WHERE ProcessID = 9100)";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[RequestQueue]"
                              + " WHERE ProcessID = 9100";
            cmd.ExecuteNonQuery();
            cmd.CommandText = "DELETE FROM [Chef].[MetaData]"
                              + " WHERE ProcessID = 9100";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "INSERT INTO [CHEF].[Metadata] VALUES "
                              + "(9100"
                              + ",'SQLTaskTest'"
                              + ",\'" + metadata + "\'"
                              + ",0"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME()"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME())";
            cmd.ExecuteNonQuery();
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ProcessID", 9100);
            cmd.Parameters.AddWithValue("@StartStepID", 9110);
            cmd.Parameters.AddWithValue("@RequestStatus", 1);
            cmd.CommandText = "CHEF.InsertRequestQueue";
            cmd.ExecuteNonQuery();

            Program_Accessor.WraperCreateSSISPkg(args);

            cmd.Parameters.Clear();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "DELETE FROM [CHEF].[RequestQueue] WHERE [QueueID] = (SELECT MAX(QueueID) FROM [CHEF].[RequestQueue] WHERE [ProcessID] = 9100)";
            cmd.ExecuteNonQuery();

            string serverName    = ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString.Split(';')[1];
            int    index         = serverName.IndexOf('=');
            int    finalStatusID = 4;
            bool   testPass      = true;

            serverName = serverName.Substring(index + 1);
            Server server = new Server(serverName);
            IntegrationServices integrationServices = new IntegrationServices(server);

            Microsoft.SqlServer.Management.IntegrationServices.PackageInfo packageInfo = null;
            ProjectInfo projectInfo = integrationServices.Catalogs["SSISDB"].Folders["CHEFFolder"].Projects["9100_SQLTaskTest"];

            Assert.IsNotNull(projectInfo);
            packageInfo = projectInfo.Packages["Package.dtsx"];
            Assert.IsNotNull(packageInfo);
            packageInfo.Execute(false, null);
            Thread.Sleep(1000);
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "SELECT MAX([StatusID])"
                              + " FROM [CHEF].[Log]"
                              + " WHERE [QueueID] ="
                              + " (SELECT [QueueID]"
                              + " FROM [CHEF].[RequestQueue]"
                              + " WHERE [ProcessID] = 9100)";
            SqlDataReader sqlDataReader = cmd.ExecuteReader();

            if (sqlDataReader.HasRows)
            {
                sqlDataReader.Read();
                finalStatusID = Convert.ToInt32(sqlDataReader[0].ToString());
            }
            if (finalStatusID == 4)
            {
                testPass = false;
            }
            sqlDataReader.Close();
            if (testPass)
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 2"
                                  + " WHERE [ProcessID] = 9100";
                cmd.ExecuteNonQuery();
            }
            else
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 4"
                                  + " WHERE [ProcessID] = 9100";
                cmd.ExecuteNonQuery();
            }
            Assert.IsTrue(testPass);
        }
Example #6
0
        public void TestExecutePackageTask()
        {
            string[]      args = { };
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString);

            conn.Open();
            SqlCommand cmd = conn.CreateCommand();

            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[Log]"
                              + " WHERE [Log].[QueueID] IN"
                              + " (SELECT QueueID FROM [CHEF].[RequestQueue]"
                              + " WHERE ProcessID = 9300)";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "DELETE FROM [Chef].[RequestQueue]"
                              + " WHERE ProcessID = 9300";
            cmd.ExecuteNonQuery();
            cmd.CommandText = "DELETE FROM [Chef].[MetaData]"
                              + " WHERE ProcessID = 9300";
            cmd.ExecuteNonQuery();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "INSERT INTO [CHEF].[Metadata] VALUES "
                              + "(9300"
                              + ",'ExecutePackageTaskTest'"
                              + ",'<CHEFMetaData ApplicationName=\"TestApplication\">"
                              + "     <Process ID=\"9300\" Name=\"DemoExecutePackage\" DefaultAllowTruncate=\"False\" VerboseLogging=\"False\" ExecuteExistingPackage=\"False\" >"
                              + "         <ConnectionSet>"
                              + "             <FileConnection key=\"dtsxPackageConnection\" FileName=\"C:\\Users\\t-satsen\\Documents\\Visual Studio 2010\\Projects\\Package_DatabaseToDatabase\\BasicFeaturesPackage\\bin\\Debug\\TableToTableDataTransferPkg.dtsx\" />"
                              + "         </ConnectionSet>"
                              + "         <Step ID=\"9310\" Name=\"Execute Package Test\" TypeID=\"1\" TypeName=\"Staging\">"
                              + "             <PackageExecution Name=\"ExecPackageTask\" Connection=\"dtsxPackageConnection\" PackageName=\"DemoPackageTask\" />"
                              + "         </Step>"
                              + "     </Process>"
                              + "</CHEFMetaData>'"
                              + ",0"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME()"
                              + ",SUSER_SNAME()"
                              + ",SYSDATETIME())";
            cmd.ExecuteNonQuery();
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ProcessID", 9300);
            cmd.Parameters.AddWithValue("@StartStepID", 9310);
            cmd.Parameters.AddWithValue("@RequestStatus", 1);
            cmd.CommandText = "CHEF.InsertRequestQueue";
            cmd.ExecuteNonQuery();

            Program_Accessor.WraperCreateSSISPkg(args);

            cmd.Parameters.Clear();
            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "DELETE FROM [CHEF].[RequestQueue] WHERE [QueueID] = (SELECT MAX(QueueID) FROM [CHEF].[RequestQueue] WHERE [ProcessID] = 9300)";
            cmd.ExecuteNonQuery();
            string serverName    = ConfigurationManager.ConnectionStrings["CHEF"].ConnectionString.Split(';')[1];
            int    index         = serverName.IndexOf('=');
            int    finalStatusID = 4;
            bool   testPass      = true;

            serverName = serverName.Substring(index + 1);
            Server server = new Server(serverName);
            IntegrationServices integrationServices = new IntegrationServices(server);

            Microsoft.SqlServer.Management.IntegrationServices.PackageInfo packageInfo = null;
            ProjectInfo projectInfo = integrationServices.Catalogs["SSISDB"].Folders["CHEFFolder"].Projects["9300_ExecutePackageTaskTest"];

            Assert.IsNotNull(projectInfo);
            packageInfo = projectInfo.Packages["Package.dtsx"];
            Assert.IsNotNull(packageInfo);
            packageInfo.Execute(false, null);
            Thread.Sleep(1000);
            cmd.Parameters.Clear();
            cmd.CommandType = System.Data.CommandType.Text;
            cmd.CommandText = "SELECT MAX([StatusID])"
                              + " FROM [CHEF].[Log]"
                              + " WHERE [QueueID] ="
                              + " (SELECT [QueueID]"
                              + " FROM [CHEF].[RequestQueue]"
                              + " WHERE [ProcessID] = 9300)";
            SqlDataReader sqlDataReader = cmd.ExecuteReader();

            if (sqlDataReader.HasRows)
            {
                sqlDataReader.Read();
                finalStatusID = Convert.ToInt32(sqlDataReader[0].ToString());
            }
            if (finalStatusID == 4)
            {
                testPass = false;
            }
            sqlDataReader.Close();
            if (testPass)
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 2"
                                  + " WHERE [ProcessID] = 9300";
                cmd.ExecuteNonQuery();
            }
            else
            {
                cmd.Parameters.Clear();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "UPDATE [CHEF].[RequestQueue]"
                                  + " SET [RequestStatus] = 4"
                                  + " WHERE [ProcessID] = 9300";
                cmd.ExecuteNonQuery();
            }

            Assert.IsTrue(testPass);
        }