Beispiel #1
0
        public void TestErrorLogging(IConnectionManager conn)
        {
            //Arrange
            CreateLogTableTask.Create(conn, "test_log");
            ControlFlow.AddLoggingDatabaseToConfig(conn, NLog.LogLevel.Trace, "test_log");
            //Act
            LogTask.Error(conn, "Error!");
            LogTask.Warn(conn, "Warn!");
            LogTask.Info(conn, "Info!");
            LogTask.Debug(conn, "Debug!");
            LogTask.Trace(conn, "Trace!");
            LogTask.Fatal(conn, "Fatal!");
            //Assert
            Assert.Equal(1, RowCountTask.Count(conn, ControlFlow.LogTable,
                                               $"{conn.QB}message{conn.QE} = 'Error!' AND {conn.QB}level{conn.QE} = 'Error' AND {conn.QB}task_action{conn.QE} = 'LOG'"));
            Assert.Equal(1, RowCountTask.Count(conn, ControlFlow.LogTable,
                                               $"{conn.QB}message{conn.QE} = 'Warn!' AND {conn.QB}level{conn.QE} = 'Warn' AND {conn.QB}task_action{conn.QE} = 'LOG'"));
            Assert.Equal(1, RowCountTask.Count(conn, ControlFlow.LogTable,
                                               $"{conn.QB}message{conn.QE} = 'Info!' AND {conn.QB}level{conn.QE} = 'Info' AND {conn.QB}task_action{conn.QE} = 'LOG'"));
            Assert.Equal(1, RowCountTask.Count(conn, ControlFlow.LogTable,
                                               $"{conn.QB}message{conn.QE} = 'Debug!' AND {conn.QB}level{conn.QE} = 'Debug' AND {conn.QB}task_action{conn.QE} = 'LOG'"));
            Assert.Equal(1, RowCountTask.Count(conn, ControlFlow.LogTable,
                                               $"{conn.QB}message{conn.QE} = 'Trace!' AND {conn.QB}level{conn.QE} = 'Trace' AND {conn.QB}task_action{conn.QE} = 'LOG'"));
            Assert.Equal(1, RowCountTask.Count(conn, ControlFlow.LogTable,
                                               $"{conn.QB}message{conn.QE} = 'Fatal!' AND {conn.QB}level{conn.QE} = 'Fatal' AND {conn.QB}task_action{conn.QE} = 'LOG'"));

            //Cleanup
            DropTableTask.Drop(conn, ControlFlow.LogTable);
        }
Beispiel #2
0
 public void TestErrorLogging()
 {
     LogTask.Error("Error");
     LogTask.Warn("Warn");
     LogTask.Info("Info");
     Assert.AreEqual(3, SqlTask.ExecuteScalar <int>("Check if default log works", "select count(*) from etl.Log where Message in ('Error','Warn','Info')"));
 }
        public void IsLoadProcessKeySetForLogTask()
        {
            //Arrange
            ControlFlow.DefaultDbConnection = SqlConnection;
            CreateLoadProcessTableTask.Create("test_lp_logtask");
            CreateLogTableTask.Create("test_log_logtask");
            ControlFlow.AddLoggingDatabaseToConfig(SqlConnection, NLog.LogLevel.Info, "test_log_logtask");

            //Act
            StartLoadProcessTask.Start("Test process 15");
            long?processId1 = ControlFlow.CurrentLoadProcess.Id;

            LogTask.Error("Test1");
            LogTask.Warn("Test2");
            LogTask.Info("Test3");
            //Assert
            Assert.Equal(3, new RowCountTask("test_log_logtask",
                                             $"message like 'Test%' AND load_process_id = {processId1}")
            {
                DisableLogging = true
            }.Count().Rows);

            //Cleanup
            DropTableTask.Drop(ControlFlow.LogTable);
            DropTableTask.Drop(ControlFlow.LoadProcessTable);
        }
Beispiel #4
0
 public void TestLogCleanup()
 {
     LogTask.Error("Error");
     LogTask.Warn("Warn");
     LogTask.Info("Info");
     CleanUpLogTask.CleanUp(0);
     Assert.AreEqual(0, new SqlTask("Check if log table is empty", $"select count(*) from etl.Log ")
     {
         DisableLogging = true
     }.ExecuteScalar <int>());
 }
Beispiel #5
0
 public void TestErrorLogging()
 {
     //Arrange
     //Act
     LogTask.Error(Connection, "Error");
     LogTask.Warn(Connection, "Warn");
     LogTask.Info(Connection, "Info");
     //Assert
     Assert.Equal(3, RowCountTask.Count(Connection, "etl.Log",
                                        "Message in ('Error','Warn','Info')"));
 }
Beispiel #6
0
        public void TestLoadProcessKeyForLogTask()
        {
            StartLoadProcessTask.Start("Test process 8");
            int?processKey1 = ControlFlow.CurrentLoadProcess.LoadProcessKey;

            LogTask.Error("Test1");
            LogTask.Warn("Test2");
            LogTask.Info("Test3");
            Assert.AreEqual(3, new SqlTask("Check if load process key is set", $"select count(*) from etl.Log where Message like 'Test%' and LoadProcessKey = {processKey1}")
            {
                DisableLogging = true
            }.ExecuteScalar <int>());
        }
 public void LogCleanup()
 {
     //Arrange
     LogTask.Error("Error");
     LogTask.Warn("Warn");
     LogTask.Info("Info");
     //Act
     CleanUpLogTask.CleanUp(Connection, 0);
     //Assert
     Assert.Equal(0, new RowCountTask("etl.Log ")
     {
         DisableLogging    = true,
         ConnectionManager = Connection
     }.Count().Rows);
 }
Beispiel #8
0
        public void IsLoadProcessKeySetForLogTask()
        {
            //Arrange
            StartLoadProcessTask.Start("Test process 15");
            int?processKey1 = ControlFlow.CurrentLoadProcess.LoadProcessKey;

            //Act
            LogTask.Error("Test1");
            LogTask.Warn("Test2");
            LogTask.Info("Test3");
            //Assert
            Assert.Equal(3, new RowCountTask("etl.Log",
                                             $"Message like 'Test%' AND LoadProcessKey = {processKey1}")
            {
                DisableLogging = true
            }.Count().Rows);
        }
Beispiel #9
0
 private void RunSubSequence()
 {
     Sequence.Execute("Test sub sequence 1.1", () =>
     {
         SqlTask.ExecuteNonQuery($"Sql #2", "Select 1 as test");
         SqlTask.ExecuteNonQuery($"Sql #3", "Select 1 as test");
         LogTask.Warn("Warn message #1");
     });
     Sequence.Execute("Test sub sequence 1.2", () =>
     {
         SqlTask.ExecuteNonQuery($"Sql #4", "Select 1 as test");
     });
     Sequence.Execute("Test sub sequence 1.3",
                      () =>
     {
         Sequence.Execute("Test sub sequence 2.1", () =>
         {
             Sequence.Execute("Test sub sequence 3.1", () =>
             {
                 SqlTask.ExecuteNonQuery($"Sql #5", "Select 1 as test");
                 SqlTask.ExecuteNonQuery($"Sql #6", "Select 1 as test");
                 LogTask.Warn("Warn message #2");
             });
             CustomTask.Execute($"Custom #1", () => {; });
             SqlTask.ExecuteNonQuery($"Sql #7", "Select 1 as test");
         });
         Sequence.Execute("Test sub sequence 2.2", () =>
         {
             CustomTask.Execute($"Custom #2", () => {; });
             SqlTask.ExecuteNonQuery($"Sql #7", "Select 1 as test");
         });
         Sequence.Execute("Test sub sequence 2.3", () =>
         {
             SqlTask.ExecuteNonQuery($"Sql #8", "Select 1 as test");
             CustomTask.Execute($"Custom #2", () => {; });
             Sequence.Execute("Test sub sequence 3.3", () =>
             {
                 SqlTask.ExecuteNonQuery($"Sql #9", "Select 1 as test");
                 SqlTask.ExecuteNonQuery($"Sql #10", "Select 1 as test");
                 LogTask.Error("Error message");
             });
         });
     });
     CustomTask.Execute($"Custom #3", () => {; });
 }