/// <summary>
 /// Complete pending test runs
 /// </summary>
 public async Task FinalizeAsync()
 {
     try
     {
         await Task.WhenAll(_runningTasks.ToArray());
     }
     catch (Exception ex)
     {
         _logger.Error($"TestRunManager.FinalizeAsync: Failed to complete test run. Error: {ex}");
     }
 }
Example #2
0
 public override void ScalarExecuted(DbCommand command, DbCommandInterceptionContext <object> interceptionContext)
 {
     _stopwatch.Stop();
     if (interceptionContext.Exception != null)
     {
         _logger.Error(interceptionContext.Exception, "Error executing command: {0}", command.CommandText);
     }
     else
     {
         _logger.TraceApi("SQL Database", "SchoolInterceptor.ScalarExecuted", _stopwatch.Elapsed, "Command: {0}: ", command.CommandText);
     }
     base.ScalarExecuted(command, interceptionContext);
 }
 /// <summary>
 /// Complete pending test runs
 /// </summary>
 public async Task FinalizeAsync()
 {
     try
     {
         await Task.WhenAll(_runningTasks.ToArray());
     }
     catch (Exception ex)
     {
         _telemetry.AddAndAggregate(TelemetryConstants.Exceptions, new List <Exception> {
             ex
         },
                                    TelemetryConstants.TestRunManagerEventArea);
         _logger.Error($"TestRunManager : FinalizeAsync : Failed to complete test run. Error: {ex}");
     }
 }
Example #4
0
        public async Task <ActionResult> Index(string q = null, int p = 1)
        {
            ViewBag.Query = q;
            ViewBag.Title = string.Format("「{0}」の検索結果", q);

            var model = new SearchResultModel {
                Query = q
            };

            var condition = new SearchCondition(q);

            try
            {
                var skip = MaxItemsOnPage * (p - 1);
                var ids  = await _searchService.SearchItemIdAsync(condition);

                var count = ids.Count();

                ViewBag.CurrentPage     = p;
                ViewBag.HasPreviousPage = (p > 1);
                ViewBag.HasNextPage     = (count > MaxItemsOnPage * p);

                var items = await _itemDbCommand.GetByIdsAsync(ids, skip, MaxItemsOnPage);

                model.Items = Mapper.Map <IEnumerable <ItemIndexModel> >(items);
            }
            catch (Exception exception)
            {
                _logger.Error(exception);
                model.HasSearchServiceError = true;
            }

            return(View(model));
        }
Example #5
0
        public override void OnException(HttpActionExecutedContext actionExecutedContext)
        {
            if (actionExecutedContext == null)
            {
                throw new ArgumentNullException("actionExecutedContext");
            }

            _traceLogger.Error(actionExecutedContext.Exception);

            base.OnException(actionExecutedContext);
        }
Example #6
0
        public static void BeforeTestRun()
        {
            try
            {
                var config = Initialize();

                var request = new StartLaunchRequest
                {
                    Name      = config.GetValue(ConfigurationPath.LaunchName, "SpecFlow Launch"),
                    StartTime = DateTime.UtcNow
                };

                if (config.GetValue(ConfigurationPath.LaunchDebugMode, false))
                {
                    request.Mode = LaunchMode.Debug;
                }

                request.Attributes = config.GetKeyValues("Launch:Attributes", new List <KeyValuePair <string, string> >()).Select(a => new ItemAttribute {
                    Key = a.Key, Value = a.Value
                }).ToList();
                request.Description = config.GetValue(ConfigurationPath.LaunchDescription, string.Empty);

                var eventArg = new RunStartedEventArgs(_service, request);
                ReportPortalAddin.OnBeforeRunStarted(null, eventArg);

                if (eventArg.LaunchReporter != null)
                {
                    _launchReporter = eventArg.LaunchReporter;
                }

                if (!eventArg.Canceled)
                {
                    Shared.Extensibility.Embedded.Analytics.AnalyticsReportEventsObserver.DefineConsumer("agent-dotnet-specflow");

                    _launchReporter = _launchReporter ?? new LaunchReporter(_service, config, null, Shared.Extensibility.ExtensionManager.Instance);

                    _launchReporter.Start(request);

                    ReportPortalAddin.OnAfterRunStarted(null, new RunStartedEventArgs(_service, request, _launchReporter));
                }
            }
            catch (Exception exp)
            {
                _traceLogger.Error(exp.ToString());
            }
        }
Example #7
0
        public override Task <Empty> NotifyExecutionStarting(ExecutionStartingRequest request, ServerCallContext context)
        {
            try
            {
                TraceLogger.Info($"{nameof(NotifyExecutionStarting)} received");
                TraceLogger.Verbose(System.Text.Json.JsonSerializer.Serialize(request));

                if (request.SuiteResult != null)
                {
                    _sender.StartLaunch(request);
                }
            }
            catch (Exception exp)
            {
                TraceLogger.Error(exp.ToString());
            }

            return(Task.FromResult(new Empty()));
        }
        public override void OnException(ExceptionContext filterContext)
        {
            if (filterContext == null)
            {
                throw new ArgumentNullException("filterContext");
            }

            _traceLogger.Error(filterContext.Exception);

            if (filterContext.HttpContext.Request.IsAjaxRequest())
            {
                HandleAjaxRequestException(filterContext);
            }
            else
            {
                base.OnException(filterContext);
            }
        }
Example #9
0
        public void Log(CreateLogItemRequest logRequest)
        {
            lock (_syncObj)
            {
                _buffer.Enqueue(logRequest);

                var dependentTask = ProcessingTask ?? _reporter.StartTask;

                ProcessingTask = dependentTask.ContinueWith(async(dt) =>
                {
                    try
                    {
                        // only if parent reporter is succesfull
                        if (!_reporter.StartTask.IsFaulted && !_reporter.StartTask.IsCanceled)
                        {
                            var requests = GetBufferedLogRequests(batchCapacity: BatchCapacity);

                            if (requests.Count != 0)
                            {
                                foreach (var logItemRequest in requests)
                                {
                                    _logRequestAmender.Amend(logItemRequest);

                                    foreach (var formatter in _extensionManager.LogFormatters)
                                    {
                                        formatter.FormatLog(logItemRequest);
                                    }
                                }

                                await _requestExecuter.ExecuteAsync(() => _service.LogItem.CreateAsync(requests.ToArray()), null).ConfigureAwait(false);
                            }
                        }
                    }
                    catch (Exception exp)
                    {
                        _traceLogger.Error($"Unexpected error occurred while processing buffered log requests. {exp}");
                    }
                }, TaskContinuationOptions.PreferFairness).Unwrap();
            }
        }
Example #10
0
 public override void Error(string message)
 {
     _log.Error("{0}", message);
 }
 internal static void OnInitializing(object sender, InitializingEventArgs eventArg)
 {
     try
     {
         Initializing?.Invoke(sender, eventArg);
     }
     catch (Exception exp)
     {
         Logger.Error($"Exception occured in {nameof(OnInitializing)} event handler: {exp}");
     }
 }