Exemple #1
0
        private void InitFakeJiraRepository(out FakeJiraApiService fakeJiraApiService,
                                            out FakeJiraIssueStorage fakeJiraIssueStorage,
                                            out JiraIssueRepository jiraIssueRepository,
                                            out BundleRepository bundleRepository)
        {
            var settings = Options.Create(new SuperDumpSettings {
                UseJiraIntegration      = true,
                JiraIntegrationSettings = new JiraIntegrationSettings {
                }
            });
            var pathHelper    = new PathHelper("", "", "");
            var dumpStorage   = new FakeDumpStorage(CreateFakeDumps());
            var bundleStorage = dumpStorage;
            var dumpRepo      = new DumpRepository(dumpStorage, pathHelper, settings);

            bundleRepository = new BundleRepository(bundleStorage, dumpRepo);

            fakeJiraApiService   = new FakeJiraApiService();
            fakeJiraIssueStorage = new FakeJiraIssueStorage();

            var identicalDumpStorage    = new FakeIdenticalDumpStorage();
            var identicalDumpRepository = new IdenticalDumpRepository(identicalDumpStorage, bundleRepository);

            var loggerFactory = new LoggerFactory();

            jiraIssueRepository = new JiraIssueRepository(settings, fakeJiraApiService, bundleRepository, fakeJiraIssueStorage, identicalDumpRepository, loggerFactory);
        }
 public HomeController(
     SuperDumpRepository superDumpRepo,
     BundleRepository bundleRepo,
     DumpRepository dumpRepo,
     IDumpStorage dumpStorage,
     IOptions <SuperDumpSettings> settings,
     PathHelper pathHelper,
     RelationshipRepository relationshipRepo,
     SimilarityService similarityService,
     ElasticSearchService elasticService,
     ILoggerFactory loggerFactory,
     IAuthorizationHelper authorizationHelper,
     JiraIssueRepository jiraIssueRepository,
     SearchService searchService,
     DownloadService downloadService)
 {
     this.superDumpRepo     = superDumpRepo;
     this.bundleRepo        = bundleRepo;
     this.dumpRepo          = dumpRepo;
     this.dumpStorage       = dumpStorage;
     this.settings          = settings.Value;
     this.pathHelper        = pathHelper;
     this.relationshipRepo  = relationshipRepo;
     this.similarityService = similarityService;
     logger = loggerFactory.CreateLogger <HomeController>();
     this.authorizationHelper = authorizationHelper;
     this.jiraIssueRepository = jiraIssueRepository;
     this.searchService       = searchService;
     this.downloadService     = downloadService;
 }
 public SimilarityController(SimilarityService similarityService, DumpRepository dumpRepository, BundleRepository bundleRepository, ILoggerFactory loggerFactory)
 {
     this.similarityService = similarityService;
     this.dumpRepository    = dumpRepository;
     this.bundleRepository  = bundleRepository;
     logger = loggerFactory.CreateLogger <SimilarityController>();
 }
Exemple #4
0
        public AnalyzerPipeline(
            DumpRepository dumpRepo,
            BundleRepository bundleRepo,
            PathHelper pathHelper,
            IOptions <SuperDumpSettings> settings,
            ElasticSearchService elasticSearch,
            SimilarityService similarityService,
            FaultReportingService faultReportingService,
            IOneAgentSdk dynatraceSdk)
        {
            var analyzers = new List <AnalyzerJob>();

            analyzers.Add(new DumpAnalyzerJob(dumpRepo, settings, pathHelper, dynatraceSdk));
            analyzers.Add(new EmptyAnalyzerJob(dumpRepo));

            var postAnalyzers = new List <PostAnalysisJob>();

            postAnalyzers.Add(new ElasticSearchJob(bundleRepo, dumpRepo, elasticSearch));
            postAnalyzers.Add(new SimilarityAnalyzerJob(similarityService, settings));
            postAnalyzers.Add(new FaultReportJob(faultReportingService, settings));

            Analyzers        = analyzers;
            InitialAnalyzers = analyzers.Where(analyzerJob => analyzerJob is InitalAnalyzerJob).Cast <InitalAnalyzerJob>();
            PostAnalysisJobs = postAnalyzers;
        }
 public DumpsController(SuperDumpRepository superDumpRepo, BundleRepository bundleRepo, DumpRepository dumpRepo, ILoggerFactory loggerFactory)
 {
     this.superDumpRepo = superDumpRepo;
     this.bundleRepo    = bundleRepo;
     this.dumpRepo      = dumpRepo;
     logger             = loggerFactory.CreateLogger <DumpsController>();
 }
 public HomeController(IHostingEnvironment environment, SuperDumpRepository superDumpRepo, BundleRepository bundleRepo, DumpRepository dumpRepo, DumpStorageFilebased dumpStorage, PathHelper pathHelper)
 {
     this.environment   = environment;
     this.superDumpRepo = superDumpRepo;
     this.bundleRepo    = bundleRepo;
     this.dumpRepo      = dumpRepo;
     this.dumpStorage   = dumpStorage;
     this.pathHelper    = pathHelper;
 }
 public EnhancedCommandInterpreter
     (OutputWriter writer,
     SystemRepository systemRepository,
     DumpRepository dumpRepository,
     HardwareFactory hardwareFactory,
     SoftwareFactory softwareFactory)
     : base(writer, systemRepository, hardwareFactory, softwareFactory)
 {
     this.dumpRepository = dumpRepository;
 }
Exemple #8
0
 public DumpAnalyzerJob(
     DumpRepository dumpRepo,
     IOptions <SuperDumpSettings> settings,
     PathHelper pathHelper,
     IOneAgentSdk dynatraceSdk)
 {
     this.dumpRepo     = dumpRepo;
     this.settings     = settings;
     this.pathHelper   = pathHelper;
     this.dynatraceSdk = dynatraceSdk;
 }
Exemple #9
0
        static void Main()
        {
            InputReader      reader           = new InputReader();
            OutputWriter     writer           = new OutputWriter();
            SoftwareFactory  softwareFactory  = new SoftwareFactory();
            HardwareFactory  hardwareFactory  = new HardwareFactory();
            SystemRepository systemRepository = new SystemRepository();
            DumpRepository   dumpRepository   = new DumpRepository();
            Engine           engine           = new Engine(reader, writer, systemRepository, dumpRepository, hardwareFactory, softwareFactory);

            engine.Run();
        }
Exemple #10
0
 public HomeController(IHostingEnvironment environment, SuperDumpRepository superDumpRepo, BundleRepository bundleRepo, DumpRepository dumpRepo, DumpStorageFilebased dumpStorage, IOptions <SuperDumpSettings> settings, PathHelper pathHelper, RelationshipRepository relationshipRepo, SimilarityService similarityService)
 {
     this.environment       = environment;
     this.superDumpRepo     = superDumpRepo;
     this.bundleRepo        = bundleRepo;
     this.dumpRepo          = dumpRepo;
     this.dumpStorage       = dumpStorage;
     this.settings          = settings.Value;
     this.pathHelper        = pathHelper;
     this.relationshipRepo  = relationshipRepo;
     this.similarityService = similarityService;
 }
 public DumpsController(
     SuperDumpRepository superDumpRepo,
     BundleRepository bundleRepo,
     DumpRepository dumpRepo,
     ILoggerFactory loggerFactory,
     SearchService searchService)
 {
     this.superDumpRepo = superDumpRepo;
     this.bundleRepo    = bundleRepo;
     this.dumpRepo      = dumpRepo;
     logger             = loggerFactory.CreateLogger <DumpsController>();
     this.searchService = searchService;
 }
Exemple #12
0
 public HomeController(IHostingEnvironment environment, SuperDumpRepository superDumpRepo, BundleRepository bundleRepo, DumpRepository dumpRepo, DumpStorageFilebased dumpStorage, IOptions <SuperDumpSettings> settings, PathHelper pathHelper, RelationshipRepository relationshipRepo, SimilarityService similarityService, ILoggerFactory loggerFactory, IAuthorizationHelper authorizationHelper)
 {
     this.environment       = environment;
     this.superDumpRepo     = superDumpRepo;
     this.bundleRepo        = bundleRepo;
     this.dumpRepo          = dumpRepo;
     this.dumpStorage       = dumpStorage;
     this.settings          = settings.Value;
     this.pathHelper        = pathHelper;
     this.relationshipRepo  = relationshipRepo;
     this.similarityService = similarityService;
     logger = loggerFactory.CreateLogger <HomeController>();
     this.authorizationHelper = authorizationHelper;
 }
        public async Task TestSlackNotification()
        {
            var settings    = Options.Create(new SuperDumpSettings());
            var fakeDump    = CreateFakeDump();
            var pathHelper  = new PathHelper("", "", "");
            var dumpStorage = new FakeDumpStorage(new FakeDump[] { fakeDump });
            var dumpRepo    = new DumpRepository(dumpStorage, pathHelper, settings);
            var slackNotificationService = new SlackNotificationService(settings, dumpRepo);
            var msg = await slackNotificationService.GetMessageModel(fakeDump.MetaInfo);

            // these assertions are bare mininum for now. Could be improved.
            Assert.Equal(1, msg.NumNativeExceptions);

            var msgStr = await slackNotificationService.GetMessage(fakeDump.MetaInfo);

            Assert.NotNull(msgStr);
        }
Exemple #14
0
 public AdminController(SimilarityService similarityService,
                        DumpRepository dumpRepository,
                        BundleRepository bundleRepository,
                        ILoggerFactory loggerFactory,
                        IdenticalDumpRepository identicalDumpRepository,
                        JiraIssueRepository jiraIssueRepository,
                        IOptions <SuperDumpSettings> settings,
                        ElasticSearchService elasticService)
 {
     this.similarityService       = similarityService;
     this.bundleRepository        = bundleRepository;
     this.identicalDumpRepository = identicalDumpRepository;
     this.jiraIssueRepository     = jiraIssueRepository;
     this.elasticService          = elasticService;
     logger        = loggerFactory.CreateLogger <AdminController>();
     this.settings = settings.Value;
 }
Exemple #15
0
        public SimilarityServiceBenchmarks()
        {
            /// fake a repository of N very similar dumps. Then let similarity calculation run
            /// simulate filesystem access with Thread.Sleep in FakeDumpStorage
            N = 1000;

            var settings = Options.Create(new SuperDumpSettings {
                SimilarityDetectionEnabled = true,
                SimilarityDetectionMaxDays = 30
            });

            this.pathHelper          = new PathHelper("", "", "");
            this.dumpStorage         = new FakeDumpStorage(CreateFakeDumps(N));
            this.dumpRepo            = new DumpRepository(dumpStorage, pathHelper, settings);
            this.relationshipStorage = new FakeRelationshipStorage();
            this.relationshipRepo    = new RelationshipRepository(relationshipStorage, dumpRepo, settings);
            this.similarityService   = new SimilarityService(dumpRepo, relationshipRepo, settings, Dynatrace.OneAgent.Sdk.Api.OneAgentSdkFactory.CreateInstance());
        }
Exemple #16
0
 public Engine
     (InputReader reader,
     OutputWriter writer,
     SystemRepository systemRepository,
     DumpRepository dumpRepository,
     HardwareFactory hardwareFactory,
     SoftwareFactory softwareFactory)
 {
     this.reader           = reader;
     this.writer           = writer;
     this.systemRepository = systemRepository;
     this.dumpRepository   = dumpRepository;
     this.hardwareFactory  = hardwareFactory;
     this.softwareFactory  = softwareFactory;
     this.interpreter      =
         new EnhancedCommandInterpreter
             (this.writer, this.systemRepository, this.dumpRepository, this.hardwareFactory, this.softwareFactory);
 }
        public SearchServiceBenchmarks()
        {
            /// fake a repository of N very similar dumps. Then let similarity calculation run
            /// simulate filesystem access with Thread.Sleep in FakeDumpStorage
            N = 100000;

            var settings = Options.Create(new SuperDumpSettings {
                WarnBeforeDeletionInDays = 2,
                UseJiraIntegration       = false,
                JiraIntegrationSettings  = new JiraIntegrationSettings()
            });

            var settingsWithJira = Options.Create(new SuperDumpSettings {
                WarnBeforeDeletionInDays = 2,
                UseJiraIntegration       = true,
                JiraIntegrationSettings  = new JiraIntegrationSettings()
            });

            this.pathHelper    = new PathHelper("", "", "");
            this.loggerFactory = new LoggerFactory();

            this.dumpStorage = new FakeDumpStorage(CreateFakeDumps(N));
            this.dumpRepo    = new DumpRepository(dumpStorage, pathHelper, settings);

            this.bundleRepo = new BundleRepository(dumpStorage, dumpRepo);

            this.identicalDumpStorage    = new FakeIdenticalDumpStorage();
            this.identicalDumpRepository = new IdenticalDumpRepository(identicalDumpStorage, bundleRepo);

            this.jiraIssueStorage    = new FakeJiraIssueStorage();
            this.jiraApiService      = new FakeJiraApiService();
            this.jiraIssueRepository = new JiraIssueRepository(settings, jiraApiService, bundleRepo, jiraIssueStorage, identicalDumpRepository, loggerFactory);

            // The Similarity Service and Elastic Search Service is not initialized since it is not required for testing the SimpleSearch
            this.searchService         = new SearchService(bundleRepo, dumpRepo, null, null, settings, jiraIssueRepository);
            this.searchServiceWithJira = new SearchService(bundleRepo, dumpRepo, null, null, settingsWithJira, jiraIssueRepository);
        }
Exemple #18
0
 public DumpsController(SuperDumpRepository superDumpRepo, BundleRepository bundleRepo, DumpRepository dumpRepo)
 {
     this.superDumpRepo = superDumpRepo;
     this.bundleRepo    = bundleRepo;
     this.dumpRepo      = dumpRepo;
 }
        public async Task TestJiraIssueRepository()
        {
            // setup dependencies
            var settings = Options.Create(new SuperDumpSettings {
                UseJiraIntegration      = true,
                JiraIntegrationSettings = new JiraIntegrationSettings {
                }
            });
            var pathHelper    = new PathHelper("", "", "");
            var dumpStorage   = new FakeDumpStorage(CreateFakeDumps());
            var bundleStorage = dumpStorage;
            var dumpRepo      = new DumpRepository(dumpStorage, pathHelper);
            var bundleRepo    = new BundleRepository(bundleStorage, dumpRepo);

            var jiraApiService   = new FakeJiraApiService();
            var jiraIssueStorage = new FakeJiraIssueStorage();

            var identicalDumpStorage    = new FakeIdenticalDumpStorage();
            var identicalDumpRepository = new IdenticalDumpRepository(identicalDumpStorage, bundleRepo);

            var loggerFactory = new LoggerFactory();

            var jiraIssueRepository = new JiraIssueRepository(settings, jiraApiService, bundleRepo, jiraIssueStorage, identicalDumpRepository, loggerFactory);

            // population
            await jiraIssueStorage.Store("bundle1", new List <JiraIssueModel> {
                new JiraIssueModel("JRA-1111")
            });

            await jiraIssueStorage.Store("bundle2", new List <JiraIssueModel> {
                new JiraIssueModel("JRA-2222"), new JiraIssueModel("JRA-3333")
            });

            await jiraIssueStorage.Store("bundle9", new List <JiraIssueModel> {
                new JiraIssueModel("JRA-9999")
            });

            await bundleRepo.Populate();

            await jiraIssueRepository.Populate();

            // actual test

            Assert.Collection(jiraIssueRepository.GetIssues("bundle1"),
                              item => Assert.Equal("JRA-1111", item.Key));

            Assert.Collection(jiraIssueRepository.GetIssues("bundle2"),
                              item => Assert.Equal("JRA-2222", item.Key),
                              item => Assert.Equal("JRA-3333", item.Key));

            Assert.Collection(jiraIssueRepository.GetIssues("bundle9"),
                              item => Assert.Equal("JRA-9999", item.Key));

            Assert.Empty(jiraIssueRepository.GetIssues("bundle3"));

            // fake, that in jira some bundles have been referenced in new issues
            jiraApiService.SetFakeJiraIssues("bundle1", new JiraIssueModel[] { new JiraIssueModel("JRA-1111") });                                 // same
            jiraApiService.SetFakeJiraIssues("bundle2", new JiraIssueModel[] { new JiraIssueModel("JRA-2222"), new JiraIssueModel("JRA-4444") }); // one added, one removed
            jiraApiService.SetFakeJiraIssues("bundle3", new JiraIssueModel[] { new JiraIssueModel("JRA-1111"), new JiraIssueModel("JRA-5555") }); // new
            jiraApiService.SetFakeJiraIssues("bundle9", null);                                                                                    // removed jira issues

            await jiraIssueRepository.SearchBundleIssuesAsync(bundleRepo.GetAll(), true);

            Assert.Collection(jiraIssueRepository.GetIssues("bundle1"),
                              item => Assert.Equal("JRA-1111", item.Key));

            Assert.Collection(jiraIssueRepository.GetIssues("bundle2"),
                              item => Assert.Equal("JRA-2222", item.Key),
                              item => Assert.Equal("JRA-4444", item.Key));

            Assert.Collection(jiraIssueRepository.GetIssues("bundle3"),
                              item => Assert.Equal("JRA-1111", item.Key),
                              item => Assert.Equal("JRA-5555", item.Key));

            Assert.Empty(jiraIssueRepository.GetIssues("bundle9"));

            var res = await jiraIssueRepository.GetAllIssuesByBundleIdsWithoutWait(new string[] { "bundle1", "bundle2", "bundle7", "bundle666", "bundle9" });

            Assert.Equal(2, res.Count());

            Assert.Collection(res["bundle1"],
                              item => Assert.Equal("JRA-1111", item.Key));

            Assert.Collection(res["bundle2"],
                              item => Assert.Equal("JRA-2222", item.Key),
                              item => Assert.Equal("JRA-4444", item.Key));


            Assert.Empty(jiraIssueRepository.GetIssues("bundle7"));
            Assert.Empty(jiraIssueRepository.GetIssues("bundle666"));
            Assert.Empty(jiraIssueRepository.GetIssues("bundle9"));
        }
Exemple #20
0
 public WebTermHandler(WebSocketConnectionManager webSocketConnectionManager, DumpRepository dumpRepo, IOptions <SuperDumpSettings> settings) : base(webSocketConnectionManager)
 {
     this.dumpRepo = dumpRepo;
     this.settings = settings;
 }
 public ElasticSearchJob(BundleRepository bundleRepo, DumpRepository dumpRepo, ElasticSearchService elasticSearch)
 {
     this.bundleRepo    = bundleRepo;
     this.dumpRepo      = dumpRepo;
     this.elasticSearch = elasticSearch;
 }
 public SimilarityController(SimilarityService similarityService, DumpRepository dumpRepository)
 {
     this.similarityService = similarityService;
     this.dumpRepository    = dumpRepository;
 }
Exemple #23
0
 public EmptyAnalyzerJob(DumpRepository dumpRepository)
 {
     this.dumpRepository = dumpRepository;
 }