Пример #1
0
 public PostprocessorOutputRecord(
     ILogSourcePostprocessor metadata,
     LogSourceRecord logSourceRecord,
     Action scheduleRefresh,
     Action fireChangeNotification,
     LJTraceSource trace,
     IHeartBeatTimer heartbeat,
     ISynchronizationContext modelSyncContext,
     ISynchronizationContext threadPoolSyncContext,
     Telemetry.ITelemetryCollector telemetry,
     IOutputDataDeserializer outputDataDeserializer)
 {
     this.metadata        = metadata;
     this.logSourceRecord = logSourceRecord;
     state = new LoadingState(new PostprocessorOutputRecordState.Context()
     {
         owner                  = this,
         scheduleRefresh        = scheduleRefresh,
         fireChangeNotification = fireChangeNotification,
         tracer                 = trace,
         telemetry              = telemetry,
         heartbeat              = heartbeat,
         modelSyncContext       = modelSyncContext,
         threadPoolSyncContext  = threadPoolSyncContext,
         outputDataDeserializer = outputDataDeserializer
     }, null, null);
 }
Пример #2
0
        public void BeforeEach()
        {
            logSources         = Substitute.For <ILogSourcesManager>();
            telemetry          = Substitute.For <Telemetry.ITelemetryCollector>();
            mockedSyncContext  = new ManualSynchronizationContext();
            heartbeat          = Substitute.For <IHeartBeatTimer>();
            progressAggregator = Substitute.For <Progress.IProgressAggregator>();
            settingsAccessor   = Substitute.For <Settings.IGlobalSettingsAccessor>();
            logSource1         = Substitute.For <ILogSource>();
            logProviderFac1    = Substitute.For <ILogProviderFactory>();
            logSource1.Provider.Factory.Returns(logProviderFac1);
            logSource1.Provider.ConnectionParams.Returns(new ConnectionParams($"{ConnectionParamsKeys.PathConnectionParam}=/log.txt"));
            logSource1.Provider.Stats.Returns(new LogProviderStats()
            {
                ContentsEtag = null
            });
            logSourcePP1 = Substitute.For <ILogSourcePostprocessor>();
            logSourcePP1.Kind.Returns(PostprocessorKind.SequenceDiagram);
            pp1outputXmlSection = Substitute.For <Persistence.ISaxXMLStorageSection>();
            logSource1.LogSourceSpecificStorageEntry.OpenSaxXMLSection("postproc-sequencediagram.xml", Persistence.StorageSectionOpenFlag.ReadOnly).Returns(pp1outputXmlSection);
            pp1outputXmlSection.Reader.Returns(Substitute.For <XmlReader>());
            pp1PostprocessorOutput = Substitute.For <IPostprocessorOutputETag>();
            outputDataDeserializer = Substitute.For <IOutputDataDeserializer>();
            outputDataDeserializer.Deserialize(PostprocessorKind.SequenceDiagram, Arg.Any <LogSourcePostprocessorDeserializationParams>()).Returns(pp1PostprocessorOutput);
            pp1RunSummary = Substitute.For <IPostprocessorRunSummary>();
            logSourcePP1.Run(null).ReturnsForAnyArgs(Task.FromResult(pp1RunSummary));
            pp1RunSummary.GetLogSpecificSummary(null).ReturnsForAnyArgs((IPostprocessorRunSummary)null);

            manager = new LogJoint.Postprocessing.PostprocessorsManager(
                logSources, telemetry, mockedSyncContext, mockedSyncContext, heartbeat, progressAggregator, settingsAccessor, outputDataDeserializer, new TraceSourceFactory());

            manager.RegisterLogType(new LogSourceMetadata(logProviderFac1, logSourcePP1));
        }
Пример #3
0
        public PostprocessorsManager(
            ILogSourcesManager logSources,
            Telemetry.ITelemetryCollector telemetry,
            ISynchronizationContext modelSyncContext,
            ISynchronizationContext threadPoolSyncContext,
            IHeartBeatTimer heartbeat,
            Progress.IProgressAggregator progressAggregator,
            Settings.IGlobalSettingsAccessor settingsAccessor,
            IOutputDataDeserializer outputDataDeserializer,
            ITraceSourceFactory traceSourceFactory
            )
        {
            this.logSources             = logSources;
            this.telemetry              = telemetry;
            this.progressAggregator     = progressAggregator;
            this.settingsAccessor       = settingsAccessor;
            this.modelSyncContext       = modelSyncContext;
            this.threadPoolSyncContext  = threadPoolSyncContext;
            this.heartbeat              = heartbeat;
            this.outputDataDeserializer = outputDataDeserializer;
            this.tracer  = traceSourceFactory.CreateTraceSource("App", "ppm");
            this.updater = new AsyncInvokeHelper(modelSyncContext, Refresh);

            logSources.OnLogSourceAdded             += (sender, args) => updater.Invoke();
            logSources.OnLogSourceRemoved           += (sender, args) => updater.Invoke();
            logSources.OnLogSourceAnnotationChanged += (sender, args) => updater.Invoke();
            logSources.OnLogSourceStatsChanged      += (object sender, LogSourceStatsEventArgs e) =>
            {
                if ((e.Flags & LogProviderStatsFlag.ContentsEtag) != 0)
                {
                    updater.Invoke();
                }
            };
            Refresh();
        }
Пример #4
0
        public PostprocessorsManager(
            ILogSourcesManager logSources,
            Telemetry.ITelemetryCollector telemetry,
            ISynchronizationContext modelSyncContext,
            ISynchronizationContext threadPoolSyncContext,
            IHeartBeatTimer heartbeat,
            Progress.IProgressAggregator progressAggregator,
            Settings.IGlobalSettingsAccessor settingsAccessor,
            IOutputDataDeserializer outputDataDeserializer,
            ITraceSourceFactory traceSourceFactory,
            ILogPartTokenFactories logPartTokenFactories,
            Correlation.ISameNodeDetectionTokenFactories sameNodeDetectionTokenFactories,
            IChangeNotification changeNotification,
            LogMedia.IFileSystem logFileSystem
            )
        {
            this.logSources                      = logSources;
            this.telemetry                       = telemetry;
            this.progressAggregator              = progressAggregator;
            this.settingsAccessor                = settingsAccessor;
            this.modelSyncContext                = modelSyncContext;
            this.threadPoolSyncContext           = threadPoolSyncContext;
            this.heartbeat                       = heartbeat;
            this.outputDataDeserializer          = outputDataDeserializer;
            this.logPartTokenFactories           = logPartTokenFactories;
            this.sameNodeDetectionTokenFactories = sameNodeDetectionTokenFactories;
            this.changeNotification              = changeNotification;
            this.logFileSystem                   = logFileSystem;
            this.tracer  = traceSourceFactory.CreateTraceSource("App", "ppm");
            this.updater = new AsyncInvokeHelper(modelSyncContext, Refresh);

            logSources.OnLogSourceAdded             += (sender, args) => updater.Invoke();
            logSources.OnLogSourceRemoved           += (sender, args) => updater.Invoke();
            logSources.OnLogSourceAnnotationChanged += (sender, args) => updater.Invoke();
            logSources.OnLogSourceStatsChanged      += (object sender, LogSourceStatsEventArgs e) =>
            {
                if ((e.Flags & LogProviderStatsFlag.ContentsEtag) != 0)
                {
                    updater.Invoke();
                }
            };

            this.visiblePostprocessorsOutputs = Selectors.Create(
                () => postprocessorsOutputs,
                () => logSources.Items,
                (outputs, sources) => {
                var sourcesMap = sources.ToLookup(s => s);
                return(ImmutableArray.CreateRange(outputs.Where(output => sourcesMap.Contains(output.LogSource))));
            }
                );

            Refresh();
        }