Ejemplo n.º 1
0
        private void ReadTraceMessages()
        {
            while (!_traceMessages.IsCompleted)
            {
                try
                {
                    ITraceMessage traceMessage = null;
                    if (!_cancellationTokenSource.IsCancellationRequested)
                    {
                        try
                        {
                            traceMessage = _traceMessages.Take(_cancellationTokenSource.Token);
                        }
                        catch (OperationCanceledException)
                        {
                            if (_traceMessages.IsCompleted)
                            {
                                return;
                            }
                            continue;
                        }
                    }

                    if (traceMessage == null)
                    {
                        if (!_traceMessages.TryTake(out traceMessage))
                        {
                            var count = _traceMessages.Count;
                            if (count > 0)
                            {
                                _errorHandler.HandleError($"Cannot take a trace message from the collection having a count of {count}.");
                            }
                            return;
                        }
                    }

                    if (!(traceMessage is MethodVisitTraceMessage))
                    {
                        throw new InvalidOperationException($"Detected unknown trace message of type {traceMessage.GetType().FullName}.");
                    }

                    var methodVisitTraceMessage = (MethodVisitTraceMessage)traceMessage;
                    MethodVisit(methodVisitTraceMessage.Spid,
                                methodVisitTraceMessage.ClassName,
                                methodVisitTraceMessage.SourceFile,
                                methodVisitTraceMessage.MethodName,
                                methodVisitTraceMessage.MethodSignature,
                                methodVisitTraceMessage.StartLineNumber,
                                methodVisitTraceMessage.EndLineNumber,
                                methodVisitTraceMessage.StartCharacter,
                                methodVisitTraceMessage.EndCharacter);
                }
                catch (Exception ex)
                {
                    _errorHandler.HandleError("Unexpected error occurred while reading from trace messages queue.", ex);
                }
            }
        }
Ejemplo n.º 2
0
        //public AccountController(
        //    IAuthenticationManager authenticationManager)
        //{
        //    _authenticationManager = authenticationManager;
        //}

        public AccountController(
            ITraceMessage traceMessageProcessor,
            IPickList pickListRegister,
            UserRegisterDto userRegisterDto)
        {
            _pickListRegister      = pickListRegister;
            _userRegisterDto       = userRegisterDto;
            _traceMessageProcessor = traceMessageProcessor;
        }
Ejemplo n.º 3
0
 public AdminController(
     IAdmin adminProcessor,
     IPickList pickListProcessor,
     ITraceMessage traceMessageProcessor)
 {
     _adminProcessor        = adminProcessor;
     _pickListProcessor     = pickListProcessor;
     _traceMessageProcessor = traceMessageProcessor;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructor
        /// </summary>
        public AddressValidationController(ITraceMessage traceMessageProcessor)
        {
            _traceMessageProcessor = traceMessageProcessor;

            _addressValidationAPIURL = ConfigurationManager.AppSettings["AddressValidationAPIURL"].ToString();

            if (String.IsNullOrEmpty(_addressValidationAPIURL))
            {
                _addressValidationAPIURL = "http://wkwebsoatest02a/AddressValidationAPI/AddressValidation/Validate";
            }
        }
Ejemplo n.º 5
0
        private void GenerateMessage(ITraceMessage beginMessage, ITraceMessage endMessage, DateTime startTime)
        {
            var item = new PageLifeCycleMessage();
            item.EventName = ProcessEventName(beginMessage.Message);
            item.StartTime = startTime;
            item.Offset = beginMessage.FromFirst;
            item.FromLast = beginMessage.FromLast;
            item.Duration = endMessage.FromFirst - beginMessage.FromFirst;
            item.EventCategory = WebFormsTimelineCategory.WebForms;

            MessageBroker.Publish(item);
        }
Ejemplo n.º 6
0
        private void GenerateMessage(ITraceMessage beginMessage, ITraceMessage endMessage, DateTime startTime)
        {
            var item = new PageLifeCycleMessage();

            item.EventName     = ProcessEventName(beginMessage.Message);
            item.StartTime     = startTime;
            item.Offset        = beginMessage.FromFirst;
            item.FromLast      = beginMessage.FromLast;
            item.Duration      = endMessage.FromFirst - beginMessage.FromFirst;
            item.EventCategory = WebFormsTimelineCategory.WebForms;

            MessageBroker.Publish(item);
        }
Ejemplo n.º 7
0
        public void ReturnData()
        {
            var model = new ITraceMessage[0];
            var dataStoreMock = new Mock<IDataStore>();
            dataStoreMock.Setup(c => c.Get(typeof(IList<ITraceMessage>).AssemblyQualifiedName)).Returns(model);
            var contextMock = new Mock<ITabContext>();
            contextMock.SetupGet(c => c.TabStore).Returns(dataStoreMock.Object);

            var trace = new Trace();
            var result = trace.GetData(contextMock.Object);

            Assert.NotNull(result);
            Assert.Equal(model, result);
        }
Ejemplo n.º 8
0
        public void ReturnData()
        {
            var model         = new ITraceMessage[0];
            var dataStoreMock = new Mock <IDataStore>();

            dataStoreMock.Setup(c => c.Get(typeof(IList <ITraceMessage>).AssemblyQualifiedName)).Returns(model);
            var contextMock = new Mock <ITabContext>();

            contextMock.SetupGet(c => c.TabStore).Returns(dataStoreMock.Object);

            var trace  = new Trace();
            var result = trace.GetData(contextMock.Object);

            Assert.NotNull(result);
            Assert.Equal(model, result);
        }
Ejemplo n.º 9
0
        private void ProcessMessage(ITraceMessage message)
        {
            if (message.Category == "ms")
            {
                if (message.Message.Contains("Begin"))
                {
                    HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEvent"] = message;
                    HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEventDateTime"] = DateTime.Now; 
                }
                else if (message.Message.Contains("End") && HttpContext.Current.Items.Contains("_GlimpseWebFormPageLifeCycleEvent"))
                {
                    var beginMessage = (ITraceMessage)HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEvent"];

                    GenerateMessage(beginMessage, message, (DateTime)HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEventDateTime"]);

                    HttpContext.Current.Items.Remove("_GlimpseWebFormPageLifeCycleEvent");
                }
            }
        }
Ejemplo n.º 10
0
        private void ProcessMessage(ITraceMessage message)
        {
            if (message.Category == "ms")
            {
                if (message.Message.Contains("Begin"))
                {
                    HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEvent"]         = message;
                    HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEventDateTime"] = DateTime.Now;
                }
                else if (message.Message.Contains("End") && HttpContext.Current.Items.Contains("_GlimpseWebFormPageLifeCycleEvent"))
                {
                    var beginMessage = (ITraceMessage)HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEvent"];

                    GenerateMessage(beginMessage, message, (DateTime)HttpContext.Current.Items["_GlimpseWebFormPageLifeCycleEventDateTime"]);

                    HttpContext.Current.Items.Remove("_GlimpseWebFormPageLifeCycleEvent");
                }
            }
        }
Ejemplo n.º 11
0
 public PDFController(IPDF pdfProcessor, ITraceMessage traceMessage)
 {
     _pdfProcesor  = pdfProcessor;
     _traceMessage = traceMessage;
 }