Exemple #1
0
        protected virtual EventResponse ReportEvent(EventInfo eventInfo)
        {
            var eventInfoWithExceptionAsString = new EventInfoWithExceptionAsString
            {
                AdditionalInfo = eventInfo.AdditionalInfo,
                Exception      = eventInfo.Exception?.ToString(),
                Message        = eventInfo.Message,
                Type           = (EventInfoWithExceptionAsString.EventType)eventInfo.Type
            };

            return(_orchestratorClient.Post <EventResponse>($"/report?testName={TestName}", eventInfoWithExceptionAsString));
        }
        private EventResponse ReportEvent(EventInfo eventInfo)
        {
            var eventInfoWithExceptionAsString = new EventInfoWithExceptionAsString
            {
                AdditionalInfo = eventInfo.AdditionalInfo,
                Exception      = eventInfo.Exception?.ToString(),
                Message        = eventInfo.Message,
                Type           = (EventInfoWithExceptionAsString.EventType)eventInfo.Type,
                EventTime      = DateTime.Now.ToString(CultureInfo.InvariantCulture)
            };

            return(_orchestratorClient.Post <EventResponse>($"/report?testName={TestName}&round={_round}", eventInfoWithExceptionAsString));
        }
        public EventResponse ReportEvent(string testName, EventInfoWithExceptionAsString @event)
        {
            using (var session = _reportingDocumentStore.OpenSession(OrchestratorDatabaseName))
            {
                var latestTest = session.Query <TestInfo>().OrderByDescending(x => x.Start).FirstOrDefault(x => x.Name == testName);
                if (latestTest != null)
                {
                    latestTest.Events.Add(@event);
                    session.SaveChanges();
                }

                //if returning EventResponse.ResponseType.Abort -> opportunity to request the test client to abort test...
                return(new EventResponse
                {
                    Type = EventResponse.ResponseType.Ok
                });
            }
        }
        public EventResponse ReportEvent(string testName, string round, EventInfoWithExceptionAsString @event)
        {
            var num = int.Parse(round);

            using (var session = _reportingDocumentStore.OpenSession(OrchestratorDatabaseName))
            {
                session.Advanced.UseOptimisticConcurrency = true;
                var latestTest = session.Query <TestInfo>().Customize(x => x.WaitForNonStaleResults(TimeSpan.FromSeconds(30))).OrderByDescending(x => x.Start).FirstOrDefault(x => x.Name == testName && x.Round == num);
                if (latestTest != null)
                {
                    latestTest.Events.Add(@event);
                    session.SaveChanges();
                }

                //if returning EventResponse.ResponseType.Abort -> opportunity to request the test client to abort test...
                return(new EventResponse
                {
                    Type = EventResponse.ResponseType.Ok
                });
            }
        }