public void SetErrorsToUiElements(ProcessTrace processResults)
        {
            processResults.ThrowIfNull(nameof(processResults));

            if (processResults.HasError)
            {
                List <StepNotificationState> errorStates = processResults.StatesLog.Where(e => e.HasError).ToList();

                foreach (StepNotificationState errorStateItem in errorStates)
                {
                    switch (errorStateItem.LowLevelErrorCode)
                    {
                    case IdMandatory.Name:

                        _projectConfigErrorMessages.IdErrorMessage = errorStateItem.LowLevelErrorMessage;
                        break;

                    case DBTypeValidator.Name:

                        _projectConfigErrorMessages.DBTypeCodeErrorMessage = errorStateItem.LowLevelErrorMessage;
                        break;

                    case DBNameValidator.Name:

                        _projectConfigErrorMessages.DBNameErrorMessage = errorStateItem.LowLevelErrorMessage;
                        break;

                    //case "ConnStr":

                    //    SetErrorInErrorProvider(tbConnStr, errorStateItem.LowLevelErrorMessage);
                    //    break;

                    //case "ConnStrToMasterDB":

                    //    SetErrorInErrorProvider(tbConnStrToMasterDB, errorStateItem.LowLevelErrorMessage);
                    //    break;

                    case DBBackupFolderValidator.Name:

                        _projectConfigErrorMessages.BackupFolderPathErrorMessage = errorStateItem.LowLevelErrorMessage;
                        break;

                    case DeliveryArtifactFolderPathValidator.Name:

                        _projectConfigErrorMessages.DeliveryArtifactFolderPathErrorMessage = errorStateItem.LowLevelErrorMessage;
                        break;

                    case DeployArtifactFolderPathValidator.Name:

                        _projectConfigErrorMessages.DeployArtifactFolderPathErrorMessage = errorStateItem.LowLevelErrorMessage;
                        break;

                    case DevScriptsBaseFolderPathValidator.Name:

                        _projectConfigErrorMessages.DevScriptsBaseFolderPathErrorMessage = errorStateItem.LowLevelErrorMessage;
                        break;
                    }
                }
            }
        }
Beispiel #2
0
        public void AfterComplete(ProcessResults processResults)
        {
            processResults.ThrowIfNull(nameof(processResults));

            _processTrace = processResults.Trace;

            System.Threading.Thread.Sleep(500);


            if (_processTrace.HasError)
            {
                NotificationsViewModelData.ProcessStatusMessage = _processTrace.InstructionsMessage;
                //$"{_processTrace.InstructionsMessage} -> {_processTrace.ErrorMessage}";

                NotificationsViewModelData.NotificationStatus = _processTrace.NotificationErrorType
                                                                switch
                {
                    NotificationErrorType.Error => NotificationStatus.Error,
                    NotificationErrorType.Attention => NotificationStatus.Attention,
                    _ => throw new Exception($"Invalid NotificationErrorType '{_processTrace.NotificationErrorType}'"),
                };
            }
            else
            {
                NotificationsViewModelData.NotificationStatus   = NotificationStatus.CompleteSuccessfully;
                NotificationsViewModelData.ProcessStatusMessage = UITextResources.CompleteSuccessfullyMessage;
            }
        }
Beispiel #3
0
        //   public void AssertRestore(string testName, DBConnectionInfo dbConnectionInfo, DBBackupFileType dbBackupFileType, ProcessTrace processTrace)
        public virtual void  AssertRestore(string testName, ProcessTrace processTrace)
        {
            Assert.That(processTrace.HasError);

            bool isRestoreExecuted =
                processTrace
                .StatesLog.Any(e => e.InternalStepNotificationState != null &&
                               !string.IsNullOrWhiteSpace(e.InternalStepNotificationState.StepName) &&
                               e.InternalStepNotificationState.StepName.StartsWith(RestoreDatabaseStep.Name));

            Assert.That(isRestoreExecuted, $"{testName} >>> Restore step was not executed");



            ////Comment: the following  check is not work because the original bak files was backup on diffrent sql server
            //string tempBackupFileToCompare = Path.Combine(FileSystemPathUtils.ParsePathVaribles(IntegrationTestsConsts.DBBackupBaseFolder), $"TempBackupFileToCompare_{DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss-fff")}");
            //_dbHandler.CreateDBBackup(dbConnectionInfo, tempBackupFileToCompare);

            //string orginalDBBackupFilePathForTheTest = _dbBackupFilesProvider.GetDBBackupFilePath(dbBackupFileType, dbConnectionInfo.DBType);

            //FileInfo fiOrginalDBBackupFilePathForTheTest = new FileInfo(orginalDBBackupFilePathForTheTest);
            //FileInfo fiTempBackupFileToCompare = new FileInfo(tempBackupFileToCompare);

            //Assert.That(fiOrginalDBBackupFilePathForTheTest.Length, Is.EqualTo(fiTempBackupFileToCompare.Length));
        }
Beispiel #4
0
        private void FireOnShowStatesLog(ProcessTrace processTrace)
        {
            if (OnShowStatesLog == null)
            {
                throw new Exception($"Bind method to 'OnShowStatesLog' event is mandatory");
            }

            StatesLogViewModel statesLogViewModel = new StatesLogViewModel(processTrace);

            OnShowStatesLog(this, new StatesLogViewModelEventArgs(statesLogViewModel));
        }
        public void ChangeViewStateAfterProcessComplete(ProcessTrace processResults)
        {
            processResults.ThrowIfNull(nameof(processResults));

            if (processResults.HasError &&
                !string.IsNullOrWhiteSpace(processResults.InstructionsMessageStepName) &&
                string.CompareOrdinal(processResults.InstructionsMessageStepName, RestoreDatabaseStep.Name) == 0)
            {
                ChangeViewState(DBVersionsViewStateType.RestoreDatabaseError);
            }
            else
            {
                ChangeViewState(DBVersionsViewStateType.ReadyToRunSync);
            }
        }
Beispiel #6
0
        public void OnNotificationStateChanged(ProcessTrace processTrace, StepNotificationState notificationStateItem)
        {
            notificationStateItem.ThrowIfNull(nameof(notificationStateItem));

            _processTrace = processTrace;

            if (NotificationsViewModelData.NotificationStatus != NotificationStatus.InProgress)
            {
                NotificationsViewModelData.NotificationStatus = NotificationStatus.InProgress;
            }

            if (!string.IsNullOrWhiteSpace(notificationStateItem.LowLevelInstructionsMessage))
            {
                NotificationsViewModelData.ProcessStatusMessage = notificationStateItem.LowLevelInstructionsMessage;
            }
            else
            {
                NotificationsViewModelData.ProcessStatusMessage = notificationStateItem.ToString();
            }
        }
        public void OnNotificationStateChanged(ProcessTrace processTrace, StepNotificationState notificationStateItem)
        {
            notificationStateItem.ThrowIfNull(nameof(notificationStateItem));

            lock (CLIConsts.ConsolWriteSync)
            {
                ClearConsoleLine(3);

                int cursorTopStart = _console.CursorTop;

                _console.ForegroundColor = ConsoleColor.DarkGray;

                _console.SetCursorPosition(3, _console.CursorTop);
                _console.Out.Write(notificationStateItem.ToString());

                int cursorTopEnd = _console.CursorTop;

                numberOfLineForLastMessage = cursorTopEnd - cursorTopStart + 1;

                _console.ForegroundColor = ConsoleColor.White;
            }
        }
 private void SetupCallbacks(TraceElements elements)
 {
     if (elements.HasFlag(TraceElements.Process))
     {
         _parser.ProcessStart += OnProcessStart;
         if (_includeInit)
         {
             _parser.ProcessDCStart += OnProcessDCStart;
             _parser.ProcessDCStop  += obj => ProcessTrace?.Invoke((ProcessTraceData)obj.Clone(), EventType.ProcessExited);
         }
         _parser.ProcessStop += OnProcessStop;
     }
     if (elements.HasFlag(TraceElements.Thread))
     {
         _parser.ThreadStart += OnThreadStart;
         _parser.ThreadStop  += OnThreadStop;
     }
     if (elements.HasFlag(TraceElements.Registry))
     {
         _parser.RegistryCreate += OnRegistryCreate;
         _parser.RegistryOpen   += obj => RegistryTrace?.Invoke((RegistryTraceData)obj.Clone(), EventType.RegistryOpenKey);
     }
 }
Beispiel #9
0
 public void OnNotificationStateChanged(ProcessTrace processTrace, StepNotificationState notificationStateItem)
 {
     _consoleProcessMessages.OnNotificationStateChanged(processTrace, notificationStateItem);
 }
Beispiel #10
0
 public void AssertContainError(string testName, ProcessTrace processTrace, string errorCode)
 {
     Assert.That(processTrace.ContainErrorCode(errorCode), $"{testName} >>> The process trace results not contain the error code: '{errorCode}'");
 }
Beispiel #11
0
 public void AssertProccessHasErrors(string testName, ProcessTrace processTrace)
 {
     Assert.That(processTrace.HasError, $"{testName} >>> Process is valid, should be an error");
 }
Beispiel #12
0
 public void AssertProccessValid(string testName, ProcessTrace processTrace)
 {
     Assert.IsFalse(processTrace.HasError, $"{testName} >>> {processTrace.GetOnlyErrorsStatesLogAsString()}");
 }
        public void ChangeViewStateAfterProcessComplete(ProcessTrace processResults)
        {
            _dbVersionsViewSateManager.ChangeViewStateAfterProcessComplete(processResults);

            ChangeViewStateForMockSniffer(LastViewState);
        }
Beispiel #14
0
 internal ProcessResults(ProcessTrace trace, object results)
 {
     Trace   = trace;
     Results = results;
 }
 public void SetErrorsToUiElements(ProcessTrace processResults)
 {
     _editProjectViewSateManager.SetErrorsToUiElements(processResults);
 }
Beispiel #16
0
        private void OnProcessDCStart(ProcessTraceData obj)
        {
            var data = (ProcessTraceData)obj.Clone();

            ProcessTrace?.Invoke(data, EventType.ProcessExists);
        }
Beispiel #17
0
 private void OnProcessStart(ProcessTraceData obj)
 {
     ProcessTrace?.Invoke((ProcessTraceData)obj.Clone(), EventType.ProcessStart);
 }